html依靠marquee完成文本上下翻转


拷贝编码
编码以下:

<BODY>
//依靠于marquee
<MARQUEE behavior="scroll" contenteditable="true" onstart="this.firstChild.innerHTML+=this.firstChild.innerHTML;" scrollamount="3" width="100">
<SPAN unselectable="on">这里是要翻转的內容</SPAN>
</MARQUEE>

//一般的完成方式
<DIV id="scrollobj" style="white-space:nowrap;overflow:hidden;width:500px;">
<span>这里是要翻转的內容</span>
</DIV>
<script language="javascript" type="text/javascript">
function scroll(obj) {
var tmp = (obj.scrollLeft)++;
//当翻转条抵达右侧顶端时
if (obj.scrollLeft==tmp) obj.innerHTML += obj.innerHTML;
//当翻转条翻转了原始內容的宽度时翻转条返回最左端
if (obj.scrollLeft>=obj.firstChild.offsetWidth) obj.scrollLeft=0;
}
setInterval("scroll(document.getElementById('scrollobj'))",20);
</script>
</BODY>