P
Phil
Hi,
This code produces an empty Alert window. No error.
How to get the value into the Alert window?
Thanks
Phil
aspx file (content page):
------------------------
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
asp:Label ID="Label1" runat="server"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClientClick="test()" />
<script language="javascript" type="text/javascript">
function test()
{
var x = document.getElementById('<%=label1.ClientID%>').innerText;
alert(x)
}
</script>
</asp:Content>
code-behind:
This code produces an empty Alert window. No error.
How to get the value into the Alert window?
Thanks
Phil
aspx file (content page):
------------------------
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
asp:Label ID="Label1" runat="server"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClientClick="test()" />
<script language="javascript" type="text/javascript">
function test()
{
var x = document.getElementById('<%=label1.ClientID%>').innerText;
alert(x)
}
</script>
</asp:Content>
code-behind: