javascript 有用的脚本函数
时间:2020-12-26 12:44:54|栏目: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;
}
}
上一篇:postman+json+springmvc测试批量添加实例
栏 目:JavaScript代码
下一篇:JavaScript实现DIV层拖动及动态增加新层的方法
本文标题:javascript 有用的脚本函数
本文地址:http://www.codeinn.net/misctech/36997.html