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

javascript拓展DOM操作 prependChild insertAfert

 更新時(shí)間:2010年11月17日 20:21:17   作者:  
Javascript dom操作中有appendChild 和insertBefore 卻沒有prependChild 和insertAfter
以下是自己寫的一個(gè)拓展函數(shù),雖然網(wǎng)上已經(jīng)有了,僅當(dāng)做自己練兵。。。
復(fù)制代碼 代碼如下:

function prependChild(o,s){
if(s.hasChildNodes()){
s.insertBefore(o,s.firstChild);
}else{
s.appendChild(o);
}
}
function insertAfert(o,s){
if(s.nextSibling!=null){
s.parentNode.insertBefore(o,s.nextSibling);
}else{
s.parentNode.appendChild(o);
}
}

相關(guān)文章

最新評(píng)論