如何获得table里面td中一个Label控件的值,控件的值是在页面加载的时候赋值的。

解决方案 »

  1.   

    var str = document.getElementById('Label1').innerHTML; //innerText
    alert(str);
      

  2.   

    document.getElementById("Label1").innerHTML;

    document.getElementById("Label1").innerText;
      

  3.   

    问下 为什么document.getElementById("<%=lblPrice.ClientID%>").value这样他取不到值
      

  4.   


      <table>
            <tr>
            <td>
                <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
            </td>
            </tr>
            </table>
      <script src="JS/jquery-1.4.4.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(function() {
                alert($("#Label1").text());
            });
        </script>
      this.Label1.Text = "hello";
      

  5.   

    document.getElementById("<%=lblPrice.ClientID%>").value这样他取不到值
    .value 改为 .innerHTML