var nav = document.getElementById('topNav');
var lis = nav.getElementsByTagName('li');
var current;
for (var i=0;i<lis.length;i++) {
if ((/\b(current)\b/).test(lis.className)) {
current = lis[i];
break;
}
}
for (var i=0;i<lis.length;i++) {
lis[i].mouseenter = function () {
current.className = '';
current = this;
this.className = 'current';
}
}怎么感觉有点小错误,你先试一下吧