javascript 有用的脚本函数
function styleHeaderSiblings(){
if(!document.getElementByTagName)return false;
var headers = document.getElementByTagName("h1");
for(var i = 0;i<headers.length;i++){
addClass(elem,"intro");
}
}
function styleElementSiblings(tag,thechass){
if(!document.getElementByTagName)return false;
var elems = document.getElementsByTagName(tag);
for(var i = 0 ;i<elems.length;i++){
var elem = getNextElement(elem[i].nextSibling);
addClass(elem,theclass);
}
}
function addClass(elemnt,value){
if(!element.className){
element.className = value;
}else{
newClassName = element.className;
newClassName +="";
newClassName +=value;
element.className = newClassName;
}
}
if(!document.getElementByTagName)return false;
var headers = document.getElementByTagName("h1");
for(var i = 0;i<headers.length;i++){
addClass(elem,"intro");
}
}
function styleElementSiblings(tag,thechass){
if(!document.getElementByTagName)return false;
var elems = document.getElementsByTagName(tag);
for(var i = 0 ;i<elems.length;i++){
var elem = getNextElement(elem[i].nextSibling);
addClass(elem,theclass);
}
}
function addClass(elemnt,value){
if(!element.className){
element.className = value;
}else{
newClassName = element.className;
newClassName +="";
newClassName +=value;
element.className = newClassName;
}
}
相关推荐
wikiwater 2020-10-27
阿斌Elements 2020-06-11
softwear 2020-08-21
ZGCdemo 2020-08-16
northwindx 2020-05-31
zrtlin 2020-11-09
xuebingnan 2020-11-05
heheeheh 2020-10-19
Crazyshark 2020-09-15
jczwilliam 2020-08-16
littleFatty 2020-08-16
idning 2020-08-03
jinxiutong 2020-07-26
lanzhusiyu 2020-07-19