欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Javascript基礎(chǔ)知識(shí)(三)BOM,DOM總結(jié)

 更新時(shí)間:2014年09月29日 09:41:05   投稿:hebedich  
本文是基礎(chǔ)知識(shí)系列的第三篇文章,主要介紹javascript中BOM,DOM的一些心得總結(jié),非常實(shí)用,有需要的朋友可以參考下

window對(duì)象:

打開和關(guān)閉窗口:

window.open()

三個(gè)參數(shù):1.載入新窗口的頁面的URL

  2.新窗口的名字

  3.特性字符串和說明是否用新載入的頁面替換當(dāng)前載入的頁面的Boolean值。

window.close()

系統(tǒng)對(duì)話框:

1.alert("hello world!");

2.confirm("Are you sure?");---選擇

3.prompt("你的名字是說明?","");

時(shí)間間隔

setTimeout("alert('hello world!')",3000)間隔3秒鐘執(zhí)行hello world只執(zhí)行一次

cleanTimeout

setInterval("alert('hello world')".3000)每隔3秒中執(zhí)行一次

CleanInterval

歷史

window.history.go(-1)回到上一頁

window.history.back回到上一頁

window.history.go(1)前進(jìn)一頁

window.history.forward前進(jìn)一頁

window.history.length查詢看歷史中的頁面數(shù)

document對(duì)象:

document.links[0]訪問鏈接

document.images[0]或document.images["imgHome"]訪問圖像

document.forms[0]或document.forms["frmSubscribe"]訪問表單

Location對(duì)象

href:當(dāng)前載入的頁面的完整的URL

DOM中最主要的節(jié)點(diǎn):

1.元素節(jié)點(diǎn)(Elenment);

2.屬性節(jié)點(diǎn)(Attributes);

3.文本節(jié)點(diǎn)(Text);

4.注釋節(jié)點(diǎn)(Comment);

所有類型節(jié)點(diǎn)的通用方法:

查找:

nodeName:節(jié)點(diǎn)名字

nodeValue:節(jié)點(diǎn)的值(主要針對(duì)文本節(jié)點(diǎn),如果是元素節(jié)點(diǎn)返回為null;)

nodeType:節(jié)點(diǎn)的類型

firstChild:第一個(gè)兒子*****

lastChild:第二個(gè)兒子*****

childNodes:所有的子節(jié)點(diǎn)*****(兩種方式)////

previousSibling:指向前一個(gè)兄弟節(jié)點(diǎn)(同級(jí)**);

nextSibling:指向后一個(gè)兄弟節(jié)點(diǎn)(同級(jí)**);

操作:

attributes:包含了代表的一個(gè)元素的特性的Attr對(duì)象,僅用于Element節(jié)點(diǎn)

appendChild:添加一個(gè)新的節(jié)點(diǎn)在最后

removeChild:刪除一個(gè)節(jié)點(diǎn)

replaceChild:替換

insertBefore:在...之前添加一個(gè)節(jié)點(diǎn)

創(chuàng)建:

createElement:創(chuàng)建一個(gè)元素節(jié)點(diǎn)

createTextNode:創(chuàng)建一個(gè)文本節(jié)點(diǎn)

克隆:

cloneNode:復(fù)制一個(gè)節(jié)點(diǎn)  true(深度復(fù)制)false(淺度復(fù)制)

訪問指定的節(jié)點(diǎn):

getElementById:查找指定的Id;

getElementsByTagName:查找指定元素的類型(數(shù)組的形式);

getElementsName:查找指定元素的Name;

屬性的查找,改變,設(shè)置:

getArrtibute:屬性的查找;

setArrtibute:屬性的改變  例如:setArribute(class,red)第一個(gè)參數(shù)是改變class,第二個(gè)設(shè)置為紅色;

removeAttibute:刪除屬性;

覆蓋,添加文本的值:

innerHTML

相關(guān)文章

最新評(píng)論