P
Phil
Hi,
The Alert window appears but the value is "undefined".
I tried two ways
What don't i see here?
Thanks
Phil
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server"><title>Untitled Page</title></head>
<body> <form id="form1" runat="server">
<asp:Label ID="label1" runat="server" text="ok" Font-Bold="True"
forecolor="lightsteelblue"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClientClick="test()" />
<script language="javascript" type="text/javascript">
function test()
{
var x = document.getElementById("label1").text;
//var x = document.getElementById('<%=label1.ClientID%>').text;
doesn't work
alert(x)
}
</script> </form> </body></html>
The Alert window appears but the value is "undefined".
I tried two ways
What don't i see here?
Thanks
Phil
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server"><title>Untitled Page</title></head>
<body> <form id="form1" runat="server">
<asp:Label ID="label1" runat="server" text="ok" Font-Bold="True"
forecolor="lightsteelblue"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClientClick="test()" />
<script language="javascript" type="text/javascript">
function test()
{
var x = document.getElementById("label1").text;
//var x = document.getElementById('<%=label1.ClientID%>').text;
doesn't work
alert(x)
}
</script> </form> </body></html>