類型轉(zhuǎn)換:parseInt\parseFloat\toString
類型判斷:typeof;eg:if(typeof(var)!="undefined")\isNaN
字符處理函數(shù):toLowerCase\touppercase\
substring(從哪里截到哪)\substr(從哪里開始;截多少個字符) \indexOf(字串中找某串字符)\replace(替換函數(shù))\
charCodeAt
concat
split
join
定時處理函數(shù):setInterval;setTimeout;clearTimeout;clearInterval
兩個顯示控制屬性:visibility(hidden,hide,show,visible);display(none,block,inline)
編碼的一些函數(shù):escape();
取得對象的方法:
document.getElementsByTagName(根據(jù)標(biāo)簽名獲得對象組)\
document.getElementsByTagName('head').item(0)
document.getElementsByName(通過NAME獲得對象)\
document.getElementById(通過ID獲得對象)\
document.form1.f1\
document.all.tags(t)[id]
document.all[id]
document.layers[id]
不常用的一些方法:
moveToAbsolute:
fromElement
toElement
contains
captureEvents
parent.frames
moveTo(x,y)
resizeBy(x,y)
resizeTo(x,y)
attachEvent('onmousedown',showHide);
document.createElement('')
document.createTextNode('')
obj.setAttribute('src','')
obj.getAttribute('')
event.srcElement
style.cssText
document.body.appendChild
document.body.removeChild
document.body.insertAdjacentHTML("AfterBegin",s)
innerHTML/
removeNode
insertBefore
arguments
event.keyCode
正則相關(guān):RegExp(eg:new RegExp("\"","g"))
一些長寬及位置屬性:
window.innerHeight
window.innerWidth
document.documentElement.clientWidth
document.documentElement.clientHeight
document.body.clientWidth
document.body.clientHeight
document.body.offsetWidth
document.body.offsetHeight
document.body.scrollLeft
document.body.scrollTop
document.location.reload()
window一些方法:
window.onerror=function(){return true;}隱去報錯
window.onload\window.onunload
window.status
window.parent.location.href
window.location.href
window.top.location.href
數(shù)學(xué)方法:
Math.max
數(shù)組方法:
length
slice
JS輸出方法:
document.write(s);
alert(s);
confirm
prompt
document.writeln
彈窗方法:
window.showModalDialog(<url>,<標(biāo)題>,<屬性>)
window.open("","","");
附:常用DOM方法和屬性(即必須掌握部分)
創(chuàng)建節(jié)點:createElement();createTextNode()
復(fù)制節(jié)點:cloneNode()
插入節(jié)點:appendChild();insertBefore()
刪除節(jié)點:removeChild()
替換節(jié)點:replaceChild()
設(shè)置節(jié)點屬性:setAttribute()
查找節(jié)點:getAttribute();getElementById();getElementsByTagName();hasChildNodes
節(jié)點的屬性:nodeName;nodeType;nodeValue
遍歷節(jié)點樹:childNodes;firstChild;lastChild;nextSibling;parentNode;previousSibling
posted on 2009-10-28 13:52
becket_zheng 閱讀(162)
評論(0) 編輯 收藏 所屬分類:
網(wǎng)頁web前端技術(shù)