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>   <title>向左滾動的文字特效JS代碼 </title>      

</head>

<body>

<div id="demo" style="overflow:hidden;height:24px; line-height:24px;width:600px; border:1px solid #666; white-space:nowrap;">

<div id="demo1">   基於jquery特效,jquery彈出層效果,js特效代碼大全,JS廣告代碼,導航菜單代碼,下拉菜單代碼和jquery焦點圖片代碼。

</div>

<div id="demo2"></div>

</div>

<script type="text/javascript"> var speed=40;//數值越大,速度越慢

var demo2=document.getElementById("demo2");

var demo1=document.getElementById("demo1");

var demo=document.getElementById("demo");

function MarqueeLeft()

{ if(demo2.offsetWidth-demo.scrollLeft<=0) demo.scrollLeft-=demo1.offsetWidth else{ demo.scrollLeft++ } }

var MyMar=setInterval(MarqueeLeft,speed); demo.onmouseover=function() {clearInterval(MyMar);} demo.onmouseout=function() {MyMar=setInterval(MarqueeLeft,speed);} </script>  

  </body> </html>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM