船长 发表于 2009-04-08 10:38 | 分类:javascript | 阅读数:515 次
js广告-翻屏效果,运行代码即可查看:
<html> <head></head> <body> <div style="HEIGHT:85px"> <script LANGUAGE='JavaScript'> document.ns = navigator.appName == "Microsoft Internet Explorer"; function showStr(str,textWidth,num) { if(!document.ns) { document.write(str[0]+'<br>') } else { var wrt=""; wrt+='<table border=0 cellspacing=0 cellpadding=0>'; wrt+='<tr><td>'; wrt+='<div id="icefable1'+num+'">'; wrt+='<table width='+textWidth+' border=0 cellspacing=0 cellpadding=0>'; for (var i in str) { wrt+='<tr><td height=20>'+str[i]+'</td></tr>'; } scroll_num=i; wrt+='</table>'; wrt+='</div>'; wrt+='<div id="icefable2'+num+'" style="position:absolute;z-index:1;visibility:hidden"></div>'; wrt+='</td></tr>'; wrt+='</table>'; document.write(wrt); } } function init_srolltext(num){countnum=0;eval('stopscroll'+num+'=false;'); eval('icefable1'+num+'.scrollTop=0;'); rotatenum=0; eval('icefable1'+num+'.style.width=0;'); eval('icefable1'+num+'.style.height=marqueesHeight;'); eval('icefable1'+num+'.style.overflowX="visible";'); eval('icefable1'+num+'.style.overflowY="hidden";'); eval('icefable1'+num+'.noWrap=true;'); eval('icefable1'+num+'.onmouseover=new Function("stopscroll=true");'); eval('icefable1'+num+'.onmouseout=new Function("stopscroll=false");'); eval('preTop'+num+'=0; '); eval('currentTop'+num+'=0;');eval('stoptime'+num+'=0;'); eval('icefable2'+num+'.innerHTML="";'); eval('icefable2'+num+'.innerHTML+=icefable1'+num+'.innerHTML;'); eval('icefable1'+num+'.innerHTML=icefable2'+num+'.innerHTML+icefable2'+num+'.innerHTML;'); eval('setInterval("scrollUp'+num+'()",40);'); } function scrollUp1() { if(stopscroll1==true) return; currentTop1+=1; if(currentTop1==marqueesHeight+1) { stoptime1+=1; currentTop1-=1; if(stoptime1==scrolllen*marqueesHeight) { currentTop1=0; stoptime1=0; } } else { preTop1=icefable11.scrollTop; icefable11.scrollTop+=1; if(icefable11.scrollTop==scrolllen*marqueesHeight+1) { preTop1=0; currentTop1=0; stoptime1=0; icefable11.scrollTop=0; }}} var strArray1=new Array();strArray1[0]='<a href=http://www.songlecn.com target=_blank><img border=0 src=http://www.songlecn.com/wp-content/supload/2009/04/08/018.jpg height=80 width=150></a> <a href=http://www.songlecn.com target=_blank><img border=0 src=http://www.songlecn.com/wp-content/supload/2009/04/08/018.jpg height=80 width=150></a> <a href=http://www.songlecn.com target=_blank><img border=0 src=http://www.songlecn.com/wp-content/supload/2009/04/08/018.jpg height=80 width=150></a> <a href=http://www.songlecn.com target=_blank><img border=0 src=http://www.songlecn.com/wp-content/supload/2009/04/08/018.jpg height=80 width=150></a> <a href=http://www.songlecn.com target=_blank><img border=0 src=http://www.songlecn.com/wp-content/supload/2009/04/08/018.jpg height=80 width=150></a> ';strArray1[1]='<a href=http://www.songlecn.com target=_blank><img border=0 src=http://www.songlecn.com/wp-content/supload/2009/04/08/01.jpg height=80 width=150></a> <a href=http://www.songlecn.com target=_blank><img border=0 src=http://www.songlecn.com/wp-content/supload/2009/04/08/01.jpg height=80 width=150></a> <a href=http://www.songlecn.com target=_blank><img border=0 src=http://www.songlecn.com/wp-content/supload/2009/04/08/01.jpg height=80 width=150></a> <a href=http://www.songlecn.com target=_blank><img border=0 src=http://www.songlecn.com/wp-content/supload/2009/04/08/01.jpg height=80 width=150></a> <a href=http://www.songlecn.com target=_blank><img border=0 src=http://www.songlecn.com/wp-content/supload/2009/04/08/01.jpg height=80 width=150></a> ';var scrolllen=strArray1.length;marqueesHeight=82;showStr(strArray1,580,1);init_srolltext(1);</script> </div> </body> </html>
提示:你可以先修改部分代码再运行。
您的网名: * 必填
电子邮件: * 绝不会泄露
个人主页:
评论内容:
(Ctrl+Enter快捷回复)
web集结号致力于