木小乐

一个效果中遇到的问题

代码如下:
//无法完美显示,主要问题在鼠标放上而又移开后不能紧接着滚动
copycode:
function $(id) {
return document.getElementById(id);
}
var aa = 0;

var hot_list = {

x: function(t, t1) {
var me = this;
var obj = $(t).getElementsByTagName("ul"),
len = obj.length;
var obj1 = obj[1].getElementsByTagName("li"),
len1 = obj1.length;

for (var i = 0; i < len1; i++) {

obj1[i].i = i;
obj1[i].onmouseover = function() {
clearInterval(timer);
hot_list.z(t, this.i);
}
obj1[i].onmouseout = function() {
timer = setInterval(function() {
hot_list.p("box");
},
1000);
}

}

},
z: function(t, node) {
var obj = $(t).getElementsByTagName("ul"),
len = obj.length;

var obj1 = obj[0].getElementsByTagName("li"),
len1 = obj1.length,
obj2 = obj[1].getElementsByTagName("li");

for (var j = 0; j < len1; j++) {

if (obj1[j].className != "none") {
obj1[j].className = "none";

}
if (j == node) {
obj1[node].className = "act";
}

if (obj2[j].className != "none") {
obj2[j].className = "none";

}
if (j == node) {
obj2[node].className = "act";
}
}
},

p: function(t, aaa) {
var me = this;
var obj = $(t).getElementsByTagName("ul"),
len = obj.length;
var obj1 = obj[1].getElementsByTagName("li"),
len1 = obj1.length;

if (aa < len1) {

hot_list.z(t, aa++);

}
else {
aa = 0;
hot_list.z(t, aa++);
}
}
};

hot_list.x("box");
var timer = setInterval(function() {
hot_list.p("box");
},
1000);




什么问题?
在onmouseout加个aa=this.i就解决了!如下:

posted on 2009-10-15 10:54  stri  阅读(110)  评论(0)    收藏  举报

导航