家装监理
4大验收阶段 78项验收标准全程把关
家装监理
4大验收阶段 78项验收标准全程把关
var sp1 = document.getElementById("sp1");
var sp2 = document.getElementById("sp2");
var p1 = document.getElementById("p1");
var p2 = document.getElementById("p2");
var bottom = document.getElementById("bottom");
var ps = bottom.getElementsByTagName("p");
var spans = bottom.getElementsByTagName("span");
var speed =-10;
var start =260;
var timer ;
var timerout;
for (var i = 0; i < ps.length; i++) {
// ps[i].index = i;
ps[i].onmouseover=function(num){
return function(){
if (timer) {
clearInterval(timer);
start=260;
};
timer = setInterval(function(){
start +=speed;
if (start<=0) {
start=0;
clearInterval(timer);
};
// console.log(this.index);
spans[num].style.top = start+"px";
},100)
}}(i)
};
for (var i = 0; i < ps.length; i++) {
ps.index = i;
ps[i].onmouseout = function(){
timerout = setInterval(function(){
**start = parseInt(spans[this.index].style.top);**
start -=speed;
spans[this.index].style.top = start+"px";
},100);
}
};
}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
spans[this.index].style中的这个 style 获取的是行内样式,你没有设置行内样式它就是undefined