跑马灯js
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> <style type="text/css"> #scrollobj01,#scrollobj02 { white-space: nowrap; overflow: hidden; width: 390px; } </style> <script type="text/javascript"> window.onload=function(){ alert(id("scrollobj01")); var _timer = setInterval("scroll01(id(‘scrollobj01‘))", 10); function _stop01() { if (_timer != null) { clearInterval(_timer); } } function _start01() { _timer = setInterval("scroll01(id(‘scrollobj01‘))", 10); } } function id(name){ return document.getElementById(name); } function scroll01(obj) { /*往左*/ var tmp = (obj.scrollLeft)++; //当滚动条到达右边顶端时 if (obj.scrollLeft == tmp) { obj.innerHTML += obj.innerHTML; } //当滚动条滚动了初始内容的宽度时滚动条回到最左端 if (obj.scrollLeft >= obj.firstChild.offsetWidth) { obj.scrollLeft = 0; } } </script> </head> <body> <div > <!--重点工作--> <div class="gdxw" style="width:510px; margin-top:3px;"> <img src="file:///C|/Users/Administrator/Desktop/images/gdxl_tp2.gif" width="115" height="22" style="float:left;" /> <div id="scrollobj01" onmouseover="javascript:_stop01();" onmouseout="javascript:_start01();" style="float:left; width:390px; font-size:14px; font-family:‘宋体‘; color:#ff0214;"> <a href="file:///C|/Users/Administrator/Desktop/${document.fileName}?id=${document.id}" target="_blank" style="color:#FF0214;"><b>${document.title}</b></a> </div> </div> <!--干部考勤情况--> <div class="gdxw" style="width:510px; margin-top:3px;"> <img src="file:///C|/Users/Administrator/Desktop/images/gdxl_tp2.gif" width="115" height="22" style="float:left;" /> <div id="scrollobj02" onmouseover="javascript:_stop02();" onmouseout="javascript:_start02();" style="float:left; width:390px; font-size:14px; font-family:‘宋体‘; color:#ff0214;"> <a href="file:///C|/Users/Administrator/Desktop/${document.fileName}?id=${document.id}" target="_blank" style="color:#FF0214;"><b>${document.title}</b></a> </div> </div> </div> </body> </html>
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。