a 元素怎么会有offsetLeft属性呢?

解决方案 »

  1.   

    <a href ="javascript:DispDiv(this.offsetLeft,this.offsetTop,1);">历史数据图 </a> 
    -----
    this==window对象
    <a href ="#" onclick ="DispDiv(this.offsetLeft,this.offsetTop,1);">历史数据图 </a>
    -----
    this==a标签你自己看着办,对象都不一样,显示肯定不一样
      

  2.   

    <html>
    <head>
    <script type="text/javascript">
    function changeSrc()
      {
      document.getElementById("myImage").src="/i/eg_smile.gif"
      }
    </script>
    </head><body>
    <img id="myImage" src="/i/eg_bulbon.gif" />
    <br /><br />
    <input type="button" onclick="changeSrc()" value="改变图像">
    </body></html>
      

  3.   

    showbo 正结在href属性中使用this 的时候,this不是当前连接,而是window对象onclick事件里的this 才是当前连接