//用js的getAttribute()方法这样做会简单邯郸,都不用封装一个函数
for (var i = 0,len=navs.length; i < len ; i++) {
var a=navs[i];
var aid=a.getAttribute("href");
//console.log(aid);
if (currentId) {
if (aid != ("#"+currentId)) {
a.className="";
}else{
a.className="current";
}
}
}
for (var i = 0,len=navs.length; i < len ; i++) {
var a=navs[i];
var aid=a.getAttribute("href");
//console.log(aid);
if (currentId) {
if (aid != ("#"+currentId)) {
a.className="";
}else{
a.className="current";
}
}
}
2017-03-22