javascript实现的跑马灯效果代码:
所谓的跑马灯就是无缝滚动效果代码,常见于新闻公告之类的功能,下面提供了一段跑马灯的代码实例供大家参考之用,希望能够对需要的朋友有所帮助。代码实例如下:
<!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="http://www.softwhy.com/" /><title>javascript新闻跑马灯效果-蚂蚁部落</title></head><script type="text/javascript">var msg="蚂蚁部落欢迎您http://www.softwhy.com";var interval = 100;var space10="";var seq=0;function Scroll() { document.tmForm.tmText.value = msg.substring(seq, msg.length) + space10 + msg.substring(0, msg.length); seq++; seq++; if(seq >msg.length) { seq=0 } window.setTimeout("Scroll();", interval )} </script><body onload="Scroll();" ><center><form name="tmForm"> <input type="text" name="tmText" size="45"></form></center></body></body></html>
原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=8190
更多内容可以参阅:http://www.softwhy.com/javascript/
原标题:javascript实现的跑马灯效果代码
关键词:JavaScript