<input type="text" id="txt" style="width: 134px" />    <input type="button" onclick="alert(document.getElementById('txt').clientWidth);" />

解决方案 »

  1.   

    ???
    <input type="text" id="txt" /> <input type="button" onclick="alert(document.getElementById('txt').scrollHeight);" value="000"/> 
      

  2.   

    onclick="alert(document.getElementById('txt').clientWidthclientWidth+4+'px');"
      

  3.   

    onclick="alert(document.getElementById('txtlength').clientWidth+4+'px');"
    clientWidth的值是小于width值得
    clientWidth = width - border
      

  4.   

    <input type="text" id="txt" /> <input type="button" onclick="alert(document.getElementById('txt').scrollHeight);" value="000"/>