一些js常用函数

add函数

function addLoadEvent(func){
var load=window.onload;
if(typeof window.onload!='function')
{
window.func=onload;
}
else
{
load();
func();
}
}

insertAfter函数

function insertAfter(newElement,tagElemnt){
parent=tagElemnt.parentNode;
if(tagElemnt==parent.lastChild)
{
parent.appendChild(newElement);
}
else
{
insertBefore(newElement,tagElemnt.nextSibling);
}
}

猜你喜欢

转载自www.cnblogs.com/zhouboke111/p/9068376.html