本文实例讲述了JS实现状态栏跑马灯文字效果代码。分享给大家供大家参考,具体如下:
这款状态栏跑马灯,文字跑动的定义在数组内,自己可修改内容。现在的IE8貌似不兼容,有缺憾的代码,欢迎JS爱好者修正,修正请发回一份。状态栏为效果显示区。
运行效果截图如下:
在线演示地址如下:
http://demo.VeVB.COm/js/2015/js-ztlpmd-txt-style-codes/
具体代码如下:
<HTML><HEAD><TITLE>间隔状态栏跑马灯</TITLE><META http-equiv=Content-Type content="text/html; charset=gb2312"><SCRIPT language=JavaScript><!--function scrollit(seed) {var m1 = "HI:你 好! ";var m2 = "欢迎访问武林网网站";var m3 = "请 多 提 意 见,谢 谢!";var m4 = "E-MAIL:";var m5 = "/";var msg=m1+m2+m3+m4+m5;var out = " ";var c = 1;if (seed > 100) {seed--;cmd="scrollit("+seed+")";timerTwo=window.setTimeout(cmd,100);}else if (seed <= 100 && seed > 0) {for (c=0 ; c < seed ; c++) {out+=" ";}out+=msg;seed--;window.status=out;cmd="scrollit("+seed+")";timerTwo=window.setTimeout(cmd,100);}else if (seed <= 0) {if (-seed < msg.length) {out+=msg.substring(-seed,msg.length);seed--;window.status=out;cmd="scrollit("+seed+")";timerTwo=window.setTimeout(cmd,100);}else {window.status=" ";timerTwo=window.setTimeout("scrollit(100)",75);}}}//--></SCRIPT><META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD><BODY bgColor=#fef4d9 onload=scrollit(100)></BODY></HTML>
希望本文所述对大家JavaScript程序设计有所帮助。
新闻热点
疑难解答