


下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、document 文擋對象 - JavaScript腳本語言描述 注:頁面上元素name屬性和JavaScript引用的名稱必須一致包括大小寫 否則會提示你一個錯誤信息 “引用的元素為空或者不是對象” 對象屬性 document.title /設置文檔標題等價于HTML的title標簽 document.bgColor /設置頁面背景色 document.fgColor /設置前景色(文本顏色 document.linkColor /未點擊過的鏈接顏色 document.alinkColor /激活鏈接(焦點在此鏈接上的顏色 document.vlinkColor /已點擊過的鏈接顏色 doc
2、ument.URL /設置URL屬性從而在同一窗口打開另一網頁 document.fileCreatedDate /文件建立日期,只讀屬性 document.fileModifiedDate /文件修改日期,只讀屬性 document.fileSize /文件大小,只讀屬性 document.cookie /設置和讀出cookie document.charset /設置字符集 簡體中文:gb2312 常用對象方法 document.write( /動態向頁面寫入內容 document.createElement(Tag /創建一個html標簽對象 document.getElementByI
3、d(ID /獲得指定ID值的對象 document.getElementsByName(Name /獲得指定Name值的對象 document.body.appendChild(oTag body-主體子對象 document.body /指定文檔主體的開始和結束等價于body>/body> document.body.bgColor /設置或獲取對象后面的背景顏色 document.body.link /未點擊過的鏈接顏色 document.body.alink /激活鏈接(焦點在此鏈接上的顏色 document.body.vlink /已點擊過的鏈接顏色 document.bo
4、dy.text /文本色 document.body.innerText /設置body>/body>之間的文本 document.body.innerHTML /設置body>/body>之間的HTML代碼 document.body.topMargin /頁面上邊距 document.body.leftMargin /頁面左邊距 document.body.rightMargin /頁面右邊距 document.body.bottomMargin /頁面下邊距 document.body.background /背景圖片 document.body.appendCh
5、ild(oTag /動態生成一個HTML對象 常用對象事件 document.body.onclick=”func(” /鼠標指針單擊對象是觸發 document.body.onmouseover=”func(” /鼠標指針移到對象時觸發 document.body.onmouseout=”func(” /鼠標指針移出對象時觸發 location-位置子對象 document.location.hash / # 號后的部分 document.location.host / 域名+端口號 document.location.hostname / 域名 document.location.href
6、 / 完整URL document.location.pathname / 目錄部分 document.location.port / 端口號 tocol / 網絡協議(http: document.location.search / ?號后的部分 documeny.location.reload( /刷新網頁 document.location.reload(URL /打開新的網頁 document.location.assign(URL /打開新的網頁 document.location.replace(URL /打開新的網頁 selection-
7、選區子對象 document.selection images集合(頁面中的圖象 a通過集合引用 document.images /對應頁面上的img標簽 document.images.length /對應頁面上img標簽的個數 document.images0 /第1個img標簽 document.imagesi /第i-1個img標簽 b通過nane屬性直接引用 img name=”oImage” document.images.oImage /屬性 c引用圖片的src屬性 document.images.oImage.src /document.
8、屬性.src d創建一個圖象 var oImage oImage = new Image( document.images.oImage.src=”1.jpg” 同時在頁面上建立一個img /標簽與之對應就可以顯示 - forms集合(頁面中的表單 a通過集合引用 document.forms /對應頁面上的form標簽 document.forms.length /對應頁面上/formform標簽的個數 document.forms0 /第1個/formform標簽 document.formsi /第i-1個/formform標簽 document.formsi.le
9、ngth /第i-1個/formform中的控件數 document.formsi.elementsj /第i-1個/formform中第j-1個控件 b通過標簽name屬性直接引用 /formform name=”Myform”>input name=”myctrl”/>/form document.Myform.myctrl /document.表單名.控件名 c訪問表單的屬性 /對應form name>屬性 document.formsi.action /對應/formform action>屬性 document.for
10、msi.encoding /對應/formform enctype>屬性 document.formsi.target /對應/formform target>屬性 document.formsi.appendChild(oTag /動態插入一個控件 document.all.oDiv /引用圖層oDiv document.all.oDiv.style.display=” /圖層設置為可視 document.all.oDiv.style.display=”none” /圖層設置為隱藏 document.getElementId(”oDiv” /通過getElementId引用對象 document.getElementId(”oDiv”.style=” document.getElementId(”oDiv”.display= ”none” /*document.all表示document中所有對象的集合 只有ie支持此屬性,因此也用來判斷瀏覽器的種類*/ 圖層對象的4個屬性 document.getElementById(”ID”.i
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
評論
0/150
提交評論