js向上滚动的问题,请教各位高手了
这个滚动代码,鼠标放上去不能停止,不知道该怎么修改,请教各位高手了,实现鼠标放上去停止,离开重新滚动效果
<div id="marquee" style="overflow:hidden;height:524px;width:250px;">
<div>
<!-- Marquee Body Head -->
<iframe frameborder='0' scrolling='no' src='http://show.v.t.qq.com/index.php?c=show&a=index&n=pony&w=250&h=518&fl=1&l=3&o=17&co=0' width='250' height='518'></iframe>
<iframe frameborder='0' scrolling='no' src='http://show.v.t.qq.com/index.php?c=show&a=index&n=mengfei&w=250&h=518&fl=1&l=3&o=17&co=0' width='250' height='518'></iframe>
<!-- Marquee Body Bottom -->
</div>
</div>
<script language="JavaScript" defer>
var obj_marquee = document.getElementById("marquee");
var marquee_spd = 9000;
var step_c = 0;
function marquee_init() {
var obj_unit = obj_marquee.firstChild;
var n = Math.ceil(parseInt(obj_marquee.style.height) / obj_unit.offsetHeight);
for(var i=0; i<n; i++) obj_marquee.appendChild(obj_unit.cloneNode(true));
return;
}
function marquee_show() {
var marquee_high = parseInt(obj_marquee.style.height);
var step = marquee_high/10;
if(obj_marquee.scrollTop >= obj_marquee.children[1].offsetTop) {
obj_marquee.scrollTop = 0;
marquee_show();
return;
}
obj_marquee.scrollTop += step;
if(step_c++ < 9) setTimeout("marquee_show()", 50);
return;
}
marquee_init();
setInterval("step_c=0;setTimeout('marquee_show()',50)", marquee_spd);
</script>
}
}
</script>
<div id="marquee" style="overflow:hidden;height:524px;width:250px;">
<div>
<!-- Marquee Body Head -->
<iframe frameborder='0' scrolling='no' src='http://show.v.t.qq.com/index.php?c=show&a=index&n=pony&w=250&h=518&fl=1&l=3&o=17&co=0' width='250' height='518'></iframe>
<iframe frameborder='0' scrolling='no' src='http://show.v.t.qq.com/index.php?c=show&a=index&n=mengfei&w=250&h=518&fl=1&l=3&o=17&co=0' width='250' height='518'></iframe>
<!-- Marquee Body Bottom -->
</div>
</div>
<script language="JavaScript" defer>
var obj_marquee = document.getElementById("marquee");
var marquee_spd = 9000;
var step_c = 0;
function marquee_init() {
var obj_unit = obj_marquee.firstChild;
var n = Math.ceil(parseInt(obj_marquee.style.height) / obj_unit.offsetHeight);
for(var i=0; i<n; i++) obj_marquee.appendChild(obj_unit.cloneNode(true));
return;
}
function marquee_show() {
var marquee_high = parseInt(obj_marquee.style.height);
var step = marquee_high/10;
if(obj_marquee.scrollTop >= obj_marquee.children[1].offsetTop) {
obj_marquee.scrollTop = 0;
marquee_show();
return;
}
obj_marquee.scrollTop += step;
if(step_c++ < 9) setTimeout("marquee_show()", 50);
return;
}
marquee_init();
setInterval("step_c=0;setTimeout('marquee_show()',50)", marquee_spd);
</script>
}
}
</script>
...全文
请发表友善的回复…
发表回复
p2227 2011-11-20
- 打赏
- 举报
<body>
<div id="marquee" style="overflow:hidden;height:524px;width:250px;">
<div>
<!-- Marquee Body Head -->
<iframe frameborder='0' scrolling='no' src='http://show.v.t.qq.com/index.php?c=show&a=index&n=pony&w=250&h=518&fl=1&l=3&o=17&co=0' width='250' height='518'></iframe>
<!-- Marquee Body Bottom -->
</div>
</div>
<script language="JavaScript" defer>
var obj_marquee = document.getElementById("marquee");
var marquee_spd = 9000;
var step_c = 0;
var stop = false;
function marquee_init() {
var obj_unit = obj_marquee.firstChild;
var n = Math.ceil(parseInt(obj_marquee.style.height) / obj_unit.offsetHeight);
for (var i = 0; i < n; i++) obj_marquee.appendChild(obj_unit.cloneNode(true));
return;
}
function marquee_show() {
if (stop)
return;
else {
var marquee_high = parseInt(obj_marquee.style.height);
var step = marquee_high / 10;
if (obj_marquee.scrollTop >= obj_marquee.children[1].offsetTop) {
obj_marquee.scrollTop = 0;
marquee_show();
return;
}
obj_marquee.scrollTop += step;
if (step_c++ < 9) setTimeout("marquee_show()", 50);
return;
}
}
marquee_init();
setInterval("step_c=0;setTimeout('marquee_show()',50)", marquee_spd);
obj_marquee.onmouseenter = function () {
stop = true;
}
obj_marquee.onmouseleave = function () {
stop = false;
marquee_show();
}
</script>
</body>wutongshu012 2011-11-20
- 打赏
- 举报
那是引用腾讯微博,我想让这个向上滚动能加个鼠标效果,鼠标移上去停止,离开继续滚动啊
wutongshu012 2011-11-20
- 打赏
- 举报
那是引用腾讯微博,我想让这个向上滚动能加个鼠标效果,鼠标移上去停止,离开继续滚动啊
默默不得鱼 2011-11-19
- 打赏
- 举报
为什么我看到了qq.com