Maison > Article > interface Web > javascript 有用的脚本函数_javascript技巧
function styleHeaderSiblings(){
if(!document.getElementByTagName)return false;
var headers = document.getElementByTagName("h1");
for(var i = 0;i
}
}
function styleElementSiblings(tag,thechass){
if(!document.getElementByTagName)return false;
var elems = document.getElementsByTagName(tag);
for(var i = 0 ;i
addClass(elem,theclass);
}
}
function addClass(elemnt,value){
if(!element.className){
element.className = value;
}else{
newClassName = element.className;
newClassName +="";
newClassName +=value;
element.className = newClassName;
}
}