javascript error: "Object required"

P

Phil

Hi,

This code gives an javascript error: "Object required" and never let see the
Alert window.
in code-behind:

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Hiddenfield1.value="end text"
end sub

in aspx file:

<asp:HiddenField ID="hd1" runat="server" value="beginning
text"></asp:HiddenField>
<asp:Button ID="Button1" OnClientClick="test()" runat="server"/>

<script language="javascript" type="text/javascript">
function test()
{
var x = document.getElementById("hd1").value
alert(x)
}
</script>

Thanks
Phil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top