文字或图片滚动循环中间有停顿代码
发布:半支烟 | 发布时间: 2009年5月30日
文字、图片滚动循环显示,中间有停顿代码:
<div id="icefable1" style="width:400;">
<!--内容区域开始,可以设为自己的内容-->
<table width='400' height="200" border='0' cellPadding='5' cellSpacing='0'>
<tr>
<td align="center" bgcolor="#F2F2F2">1。内容可以自己定义</td>
</tr>
<tr>
<td align="center" bgcolor="#F9FAED">2。内容可以自己定义</td>
</tr>
</table>
<!--内容区域结束-->
</div>
<div id="icefable2" style="position:absolute;z-index:1;visibility:hidden"></div>
<script>
marqueesHeight=100;//滚动区域高度设定
stopscroll=false;
icefable1.scrollTop=0;
with(icefable1){
style.width=0;
style.height=marqueesHeight;
style.overflowX="visible";
style.overflowY="hidden";
noWrap=true;
onmouseover=new Function("stopscroll=true");
onmouseout=new Function("stopscroll=false");
}
preTop=0; currentTop=0; stoptime=0;
function init_srolltext(){
icefable2.innerHTML="";
icefable2.innerHTML+=icefable1.innerHTML;
icefable1.innerHTML=icefable2.innerHTML+icefable2.innerHTML;
setInterval("scrollUp()",20);
}
function scrollUp(){
if(stopscroll==true) return;
currentTop+=1;
if(currentTop==100)//向上滚动高度设定
{
stoptime+=1;
currentTop-=1;
if(stoptime==150)//停顿时间设定
{
currentTop=0;
stoptime=0;
}
}
else {
preTop=icefable1.scrollTop;
icefable1.scrollTop+=1;
if(preTop==icefable1.scrollTop){
icefable1.scrollTop=icefable2.offsetHeight-marqueesHeight;
icefable1.scrollTop+=1;
}
}
}
init_srolltext();
</script>
(在需要添加该特效的网页具体位置中粘贴如下代码即可可以根据需要进行修改。)
- 相关文章:
网页弹窗代码_网页自动弹出窗口代码 (2009-5-30 21:53:54)
网页中文字图片滚动代码_网页跑马效果 (2009-5-29 2:19:30)
代码实现网页的简体字和繁体字转换_简繁网页转换 (2009-5-29 2:18:36)
禁止网页内容被复制代码_屏蔽鼠标右键 (2009-5-29 2:9:31)
如何统计当前人数_统计网站当前在线人数代码 (2009-5-29 2:4:20)
发表评论
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。






收藏本文: 






















