I have a Javascript
function
show()
{
alert("hello");
}
which runs on ASP Button OnClick Event.
When I click the button of alert message box showing "hello", postback occurs. Is there any way I cant prevent this postback?
I have a Javascript
function
show()
{
alert("hello");
}
which runs on ASP Button OnClick Event.
When I click the button of alert message box showing "hello", postback occurs. Is there any way I cant prevent this postback?
Share Improve this question edited Sep 25, 2012 at 18:46 Gonzalo.- 12.7k5 gold badges52 silver badges83 bronze badges asked Nov 23, 2009 at 17:14 MishigenMishigen 1,2616 gold badges26 silver badges37 bronze badges4 Answers
Reset to default 4Try:
return false;
Yes, you can do show(); return false;
in the button's onclick handler.
onclick="show();return false;"
it's very simple: insert aber the "Alert('msg');" a "return false;".
so:
function show()
{
alert('Hallo');
return false;
}