假設我有個textbox寬設成100%,要如何才能於RUN TIME時得到Control實際的寬(px)????

解决方案 »

  1.   

    是呀,不好意思写错了,是width.
      

  2.   

    是否可以用JS得到TextBox宽度的像素值?我对JS不熟,那位仁兄能提供一段代码吗?
      

  3.   

    To: softdeveloper(笨蛋天才)
      好像还是不行,我写了如下代码:<asp:TextBox ID="textbox1" Runat="server" Width="50%">aaa</asp:TextBox>
    <input type="button" name="button1" onclick="button_click()" value="click me">
    <script>
    function button_click()
    {
    var width=document.Form1.textbox1.style.width;
    alert(width);
    }
    </script>
    得到的是50%,不是像素呀,而且如果不设置textbox1的Width得到是空。
      

  4.   

    TO:gngnandgngn(仗义执言)
      我改成pixelwidth了,可是显示出来的是"undefined"。咋整呀?