<br><div class="msgheader"> <div class="right"><span style="CURSOR: pointer" onclick="copycode(getid('phpcode29'));"><u>複製程式碼</u></span></div>程式碼如下:</div> <div class="msgborder" id="phpcode29"> <br><br>////都藉助於🎜><marquee behavior="scroll" contenteditable="true" onstart="this.firstChild.innerHTML =this.firstChild.innerHTML;" scrollamount="3" width="100"><br><span unselectable="on unselectable=" on>這裡是要捲動的內容</span><br></marquee><br><br>//普通的實作方法<br><div id="scrollobj" style="white-space:nowrap; overflow:hidden;width:500px;"> <br><span>這裡是要捲動的內容</span><br> </div> <br><script language="javascript" type="text/javascript"><br />function scroll(obj) {<br />var tmp = (obj.scrollLeft) ;<br />//當捲軸到達右邊頂端時<br />if (obj.scrollLeft==tmp) obj.innerHTML = obj.innerHTML;<br />//當滾動條滾動了初始內容的寬度時滾動條回到最左端<br />if (obj.scrollLeft>=obj.firstChild.offsetWidth) obj.scrollLeft=0;<br /> }<br />setInterval("scroll(document.getElementById('scrollobj'))",20);<br /></script><br> <br><br> </div>