JavaScript特效:实现上下文字、图片滚动循环显示,中间有停顿
分类:网页设计 Tags: javascript 评论:1 浏览:14010 最近更新时间:2007/3/1 19:26:44
文字、图片滚动循环显示,中间有停顿代码:
<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>
(在需要添加该特效的网页具体位置中粘贴如下代码即可可以根据需要进行修改。)
-
• 全球100强优秀企业官方网站经典网站集合
• 通过css的@font-face属性,在网页上显示用户电脑没有的字体
• (asp转html) asp生成静态网页文件0kb解决方法
• input为灰色的两种状态的区别,input只读
• cn域名被clientHold停止解析怎么办
• 庆2007新年,猪猪网页设计素材送上,免费共享给大家下载(图)
• 教你如何用CSS Sprites(图片合并)技术切图
• 世界最大域名注册商Godaddy.com介绍
• 同一页面不同链接颜色,自定义链接不同颜色样式
• Dreamweaver CS3集成AJAX框架Spry之表单检测试用