日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

html Window与document区别(轉)

發布時間:2023/12/18 编程问答 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 html Window与document区别(轉) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
html Window與document區別(轉)

Window -- 代表瀏覽器中一個打開的窗口:

對象屬性
  window //窗口自身
  window.self //引用本窗戶window=window.self
  window.name //為窗口命名
  window.defaultStatus //設定窗戶狀態欄信息
  window.location //URL地址,配備布置這個屬性可以打開新的頁面

對象方法
  window.alert("text") //提示信息會話框
  window.confirm("text") //確認會話框
  window.prompt("text") //要求鍵盤輸入會話框
  window.setIntervel("action",time) //每一隔指定的時間(毫秒)就執行一次操作
  window.clearInterval() //清除時間配備布置作用就是終止輪回
  window.setTimeout(action,time) //隔了指定的時間(毫秒)執行一次操作
  window.open() //打開新的窗口
  window.close() //關閉窗口

成員對象
  window.event
  window.document //見document對象詳解
  window.history
  window.screen
  window.navigator
  window.external
  -------------------------------------------------- -------------------
  window.history對象
  window.history.length //瀏覽過的頁面數
  history.back() //后退
  history.forward() //前進
  history.go(i) //前進或后退到歷史記錄的第i個頁面
  //i>0進步,i<0 后退
 ???------------------------------------------------- -------------------
  window.screen對象
???? window.screen.width //屏幕寬度
  window.screen.height //屏幕高度
  window.screen.colorDepth //屏幕色深
  window.screen.availWidth //可用寬度
  window.screen.availHeight //可用高度(除去任務欄的高度)
  -------------------------------------------------- -------------------
  window.external對象
  window.external.AddFavorite("地址","標題" ) //把網站新增到保藏夾
  -------------------------------------------------- -------------------
  window.navigator對象
  window.navigator.appCodeName //瀏覽器代碼名
  window.navigator.appName //瀏覽器應用程序名
  window.navigator.appMinorVersion //瀏覽器補丁版本
  window.navigator.cpuClass //cpu類型 x86
  window.navigator.platform //操作體系類型 win32
  window.navigator.plugins
  window.navigator.opsProfile
  window.navigator.userProfile
  window.navigator.systemLanguage //客戶體系語言 zh-cn簡體中文
  window.navigator.userLanguage //用戶語言,同上
  window.navigator.appVersion //瀏覽器版本
  window.navigator.userAgent
  window.navigator.onLine //用戶否在線
  window.navigator.cookieEnabled //瀏覽器是否撐持cookie
  window.navigator.mimeTypes

document對象 -- 代表整個HTML?文檔,可用來訪問頁面中的所有元素:

對象屬性

document.title?????????????????//設置文檔標題等價于HTML的
document.bgColor???????????????//設置頁面背景色
document.fgColor???????????????//設置前景色(文本顏色)
document.linkColor?????????????//未點擊過的鏈接顏色
document.alinkColor????????????//激活鏈接(焦點在此鏈接上)的顏色
document.vlinkColor????????????//已點擊過的鏈接顏色
document.URL???????????????????//設置URL屬性從而在同一窗口打開另一網頁
document.fileCreatedDate???????//文件建立日期,只讀屬性
document.fileModifiedDate??????//文件修改日期,只讀屬性
document.fileSize??????????????//文件大小,只讀屬性
document.cookie????????????????//設置和讀出cookie
document.charset???????????????//設置字符集 簡體中文:gb2312

常用對象方法

document.write()??????????????????????//動態向頁面寫入內容
document.createElement_x(Tag)???????????//創建一個html標簽對象
document.getElementByIdx_x(ID)???????????//獲得指定ID值的對象
document.getElementsByName(Name)??????//獲得指定Name值的對象
document.body.appendChild(oTag)

body-主體子對象

document.body???????????????????//指定文檔主體的開始和結束等價于
document.body.bgColor???????????//設置或獲取對象后面的背景顏色
document.body.link??????????????//未點擊過的鏈接顏色
document.body.alink?????????????//激活鏈接(焦點在此鏈接上)的顏色
document.body.vlink?????????????//已點擊過的鏈接顏色
document.body.text??????????????//文本色
document.body.innerText?????????//設置...之間的文本
document.body.innerHTML?????????//設置...之間的HTML代碼
document.body.topMargin?????????//頁面上邊距
document.body.leftMargin????????//頁面左邊距
document.body.rightMargin???????//頁面右邊距
document.body.bottomMargin??????//頁面下邊距
document.body.background????????//背景圖片
document.body.appendChild(oTag) //動態生成一個HTML對象

常用對象事件

document.body.οnclick="func()"??????????????//鼠標指針單擊對象是觸發
document.body.οnmοuseοver="func()"??????????//鼠標指針移到對象時觸發
document.body.οnmοuseοut="func()"???????????//鼠標指針移出對象時觸發

location-位置子對象

document.location.hash??????????// #號后的部分
document.location.host??????????// 域名+端口號
document.location.hostname??????// 域名
document.location.href??????????// 完整URL
document.location.pathname??????// 目錄部分
document.location.port??????????// 端口號
document.location.protocol??????// 網絡協議(http:)
document.location.search????????// ?號后的部分

常用對象事件

documeny.location.reload()??????????//刷新網頁
document.location.reload(URL)???????//打開新的網頁
document.location.assign(URL)???????//打開新的網頁
document.location.replace(URL)??????//打開新的網頁
========================================================================
selection-選區子對象
document.selection
========================================================================
images集合(頁面中的圖象):
----------------------------
a)通過集合引用
document.images?????????????????//對應頁面上的標簽
document.images.length??????????//對應頁面上標簽的個數
document.images[0]??????????????//第1個標簽??????????
document.images[i]??????????????//第i-1個標簽
----------------------------
b)通過nane屬性直接引用

document.images.oImage??????????//document.images.name屬性
----------------------------
c)引用圖片的src屬性
document.images.oImage.src??????//document.images.name屬性.sr

?

http://blog.sina.com.cn/s/blog_70441c8e0102vvvf.html

posted on 2017-10-30 13:49 鄭軍學長 閱讀(...) 評論(...) 編輯 收藏

轉載于:https://www.cnblogs.com/ZHENGJUNupperclassman/p/7754152.html

總結

以上是生活随笔為你收集整理的html Window与document区别(轉)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。