<html>
<head>
<div id=demo style="overflow:hidden;height:100px;width:300px;">
<table align=left cellpadding=0 cellspace=0 border=2>
<tr><td id=demo1 valign=top>
<img src="http://www.hrbseo.com/images/index2.jpg">
<img src="http://www.hrbseo.com/images/index3.jpg">
<img src="http://www.hrbseo.com/images/index1.jpg">
<img src="http://www.hrbseo.com/images/index2.jpg">
<img src="http://www.hrbseo.com/images/index3.jpg">
<img src="http://www.hrbseo.com/images/index1.jpg">
</td>
<td id=demo2 valign=top></td>
</tr>
</table>
</div> 
<script> var speed=30 
demo2.innerHTML=demo1.innerHTML 
function Marquee(){ 
if(demo2.offsetWidth-demo.scrollLeft<=0) 
demo.scrollLeft-=demo1.offsetWidth 
else{ 
demo.scrollLeft++ 
}

var MyMar=setInterval(Marquee,speed) 
demo.onmouseover=function() {clearInterval(MyMar)} 
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)} </script>
</head>
</html>刚学JS
求offsetwidth scrollleft属性的含义,要详细点哦。谢谢啦
给我发个关于这些教程的网址也行哦。

解决方案 »

  1.   

    首先 offsetwidth scrollleft 与 js 无关,它们都是 html 控件属性!Web 开发常用手册DHTML 参考手册 —— 这里都有!
    http://download.csdn.net/source/308913JScript 语言参考
    http://download.csdn.net/source/308916CCS 样式表中文手册
    http://download.csdn.net/source/304124
      

  2.   

    offsetWidth、offsetHeightobj.offsetWidth 指 obj 控件自身的绝对宽度,不包括因 overflow 而未显示的部分,也就是其实际占据的宽度,整型,单位像素。具体算法请参见 offsetWidth、offsetHeight 算法。
    obj.offsetHeight 指 obj 控件自身的绝对高度,不包括因 overflow 而未显示的部分,也就是其实际占据的高度,整型,单位像素。scrollLeft是获取滚动向右拉动的值.