marquee上下滚动停顿效果

  

  

< HTML >< HEAD >< TITLE > marquee上下滚动停顿效果 </ TITLE >
< META http - equiv = Content - Type content = " text/html; charset=gb2312 " >
< META content = " MSHTML 6.00.3790.118 "  name = GENERATOR >

< meta http - equiv = " Content-Type "  content = " text/html; charset=gb2312 " >
< style >
.title td {FONT
- SIZE:14px;color: #0F0F0F;font - family: Verdana, Arial, Helvetica, sans - serif;}
.title a:link {COLOR:#3C3C3C;TEXT
- DECORATION:none;}
.title a:visited {COLOR:#3C3C3C;TEXT
- DECORATION:none;}
.title a:active {COLOR:#3C3C3C;TEXT
- DECORATION:none;}
.title a:hover {COLOR:#0099FF;TEXT
- DECORATION:none;}
</ style >
</ HEAD >

< script >
var marqueeContent
= new  Array();

marqueeContent[
0 ] = ' <img src="http://ossweb-img2.qq.com/images/web/title/dot_news.gif" width="11" height="11">&nbsp;<a href="http://www.cnblogs.com/ntearn" target="_blank">[冰河博客园]记录日常操作中遇到问题的解决方法,以备查询!</a><br> '

marqueeContent[
1 ] = ' <img src="http://ossweb-img2.qq.com/images/web/title/dot_news.gif" width="11" height="11">&nbsp;<a href=http://www.wycaifu.com/ target="_blank">[爱搜索]搜索属于你的互联网世界!</a><br> '

marqueeContent[
2 ] = ' <img src="http://ossweb-img2.qq.com/images/web/title/dot_news.gif" width="11" height="11">&nbsp;<a href="http://www.ecoswaya.com/" target="_blank">[E科士威]同样是购物,换一种方式,会有额外的折扣与加报!</a><br> '

var marqueeInterval
= new  Array();
var marqueeId
= 0 ;
var marqueeDelay
= 3000 ;
var marqueeHeight
= 19 ;
function initMarquee() {
var str
= marqueeContent[ 0 ];
document.write(
' <div id="marqueeBox" style="overflow:hidden;height: ' + marqueeHeight + ' px" οnmοuseοver="clearInterval(marqueeInterval[0])" οnmοuseοut="marqueeInterval[0]=setInterval(\ ' startMarquee()\ ' ,marqueeDelay)"><div> ' + str + ' </div></div> ' );
marqueeId
++ ;
marqueeInterval[
0 ] = setInterval( " startMarquee() " ,marqueeDelay);

}
function startMarquee() {
var str
= marqueeContent[marqueeId];
marqueeId
++ ;
if (marqueeId >= marqueeContent.length) marqueeId = 0 ;
if (document.getElementById( " marqueeBox " ).childNodes.length == 1 ) {
var nextLine
= document.createElement( ' DIV ' );
nextLine.innerHTML
= str;
document.getElementById(
" marqueeBox " ).appendChild(nextLine);
}
else  {
   document.getElementById(
" marqueeBox " ).childNodes[ 0 ].innerHTML = str;
   document.getElementById(
" marqueeBox " ).appendChild(document.getElementById( " marqueeBox " ).childNodes[ 0 ]);
   document.getElementById(
" marqueeBox " ).scrollTop = 0 ;
}
clearInterval(marqueeInterval[
1 ]);
marqueeInterval[
1 ] = setInterval( " scrollMarquee() " , 20 );
}
function scrollMarquee() {
document.getElementById(
" marqueeBox " ).scrollTop ++ ;
if (document.getElementById( " marqueeBox " ).scrollTop % marqueeHeight == (marqueeHeight - 1 )){
clearInterval(marqueeInterval[
1 ]);
}
}
</ script >
< body leftmargin = " 100 "  topmargin = " 100 "  marginwidth = " 0 "  marginheight = " 0 "  style = " background-color:transparent " >

< table width = " 100% "  border = " 0 "  cellspacing = " 0 "  cellpadding = " 0 "   class = " title " >
< tr >
   
< td >< script > initMarquee() </ script ></ td >
</ tr >
</ table >

</ BODY ></ HTML >

 

点击查看演示效果:

转载于:https://www.cnblogs.com/ntearn/archive/2009/04/28/1445058.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值