P
Phil
Hi,
I'm a little confused about the precedence of actions between OnClientClick
and OnClick. In this example, what will be executed first and why?
Thanks
Phil
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>
I'm a little confused about the precedence of actions between OnClientClick
and OnClick. In this example, what will be executed first and why?
Thanks
Phil
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>