日期:2014-05-16  浏览次数:20311 次

菜鸟,急,急急,急急急,请老程序人给看看,以下的JS哪错了。好了立即给分。
<script   language= "javascript ">
function   showinfo()
{
//sp.innerHTML   =this.scrollTop;
document.getElementById( "sp ").innerHTML   =document.getElementById( "div1 ").scrollTop;
document.getElementById( "sp1 ").innerHTML= "scrollTop: "+document.getElementById( "div1 ").scrollTop;
document.getElementById( "sp2 ").innerHTML= "clientHeight: "+document.getElementById( "div1 ").clientHeight;
document.getElementById( "sp3 ").innerHTML= "scrollHeight: "+document.getElementById( "div1 ").scrollHeight;
}
</script>
<div   id= "div1 "   style= "width:   400px;   height:   300px;   background:   green;overflow:   scroll; "   onscroll= "showinfo(); ">      
<div   style= "width:   300px;   height:   600px;   background:   gray; "> </div>      
</div>      
<br> <span   id= "sp "/>
<br> <span   id= "sp1 "/>
<br> <span   id= "sp2 "/>
<br> <span   id= "sp3 "/>

为什么只有> <span   id= "sp "/> 显示数据,其它的都不显示呢??在线。

------解决方案--------------------
<br> <span id= "sp "> </span>
<br> <span id= "sp1 "> </span>
<br> <span id= "sp2 "> </span>
<br> <span id= "sp3 "> </span>
写成这样
------解决方案--------------------
<br> <span id= "sp "> </span>
<br> <span id= "sp1 "> </span>
<br> <span id= "sp2 "> </span>
<br> <span id= "sp3 "> </span>