<scripttype="text/javascript">
window.onload =function(){var speed =20;var td1 = document.getElementById("td1");var td2 = document.getElementById("td2");
td2.innerHTML = td1.innerHTML;var div1 = document.getElementById("div1");functiongoLeft(){if (td1.offsetWidth - div1.scrollLeft <0) {
div1.scrollLeft = div1.scrollLeft - td1.offsetWidth;
}else {
div1.scrollLeft++;
}
}
setInterval(goLeft,speed);
}</script><divid="div1"style="overflow:hidden;width:800px;height:50px;"><tablestyle="width: 800px;height: 45px;background-color: silver;"><tr><tdid="td1"><tablestyle="width: 800px;height: 45px;background-color: silver;"><tr><tdalign="center"><fontsize="5px"color=blue>JS实现滚动窗口</font></td></tr></table></td><tdid="td2"></td></tr></table></div>