Hi...
M a newbe to asp.net. I am trying to use a javascript function in my asp.net page. The function works fine but for the second time. I have made a function that displays an alert box. but wen i click the button for the first time nothing happens but on second click the alert box is displayed. y so?
here's the code:
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.Click
Button1.Attribu tes.Add("onClic k", "return hello()")
End Sub
n her's the javascript function included in the head of the asp.net form
<script language="javas cript">
function hello()
{
var msg= "hello"
alert(msg);
}
</script>
M a newbe to asp.net. I am trying to use a javascript function in my asp.net page. The function works fine but for the second time. I have made a function that displays an alert box. but wen i click the button for the first time nothing happens but on second click the alert box is displayed. y so?
here's the code:
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.Click
Button1.Attribu tes.Add("onClic k", "return hello()")
End Sub
n her's the javascript function included in the head of the asp.net form
<script language="javas cript">
function hello()
{
var msg= "hello"
alert(msg);
}
</script>
Comment