后缀名置换及去括号代码
2015-02-26 02:22:14 -0500
以下是
小羊
大师的共享代码,在此代表全体磨友向他以及在本平台做出努力的骄骄者致谢。
第一种方案
var i=0; var l=document.querySelectorAll('li'); while(i
撰文'); } else{ l[i].lastChild.innerHTML=l[i].lastChild.innerHTML.slice(1,-1); } i++; } var str=document.getElementById("whole_body").innerHTML; var x=str.replace(/English/g,"英文").replace(/下一页/g,"下页").replace(/上一页/g,"上页").replace(/txt/g,"文本").replace(/gif/g,"动图").replace(/apk/g,"安软").replace(/jpg/g,"静图").replace(/png/g,"图片").replace(/mp3/g,"音乐").replace(/ucw/g,"皮肤"). replace(/\|/g," "); document.getElementById("whole_body").innerHTML=x; var scvar,sctag=document.getElementsByTagName("li"); for(scvar=0;scvar
撰文"; } scvar++; }
第二种方案
var str=document.getElementById("whole_body").innerHTML; var x=str.replace(/English/g,"英文").replace(/下一页/g,"下页").replace(/上一页/g,"上页").replace(/txt/g,"文本").replace(/gif/g,"动图").replace(/apk/g,"安软").replace(/jpg/g,"静图").replace(/png/g,"图片").replace(/mp3/g,"音乐").replace(/ucw/g,"皮肤"). replace(/\|/g," "); document.getElementById("whole_body").innerHTML=x; var scvar,sctag=document.getElementsByTagName("li"); for(scvar=0;scvar
撰文"; } else{ sctag[scvar].getElementsByTagName("span")[0].innerHTML=sctag[scvar].getElementsByTagName("span")[0].innerHTML.slice(1,-1); } scvar++; }
备注,:以上两种方案都能达到预期效果。代码虽然长了一点,但最重要的是不影置换代码
«Newer
Older»
Comment:
Name:
Back to home
Subscribe
|
Register
|
Login
|
N