views:

93

answers:

4

i have a javascript function show() { alert("hello"); } which runs on asp button onclick event when i click on OK button of alert message box showing hello,,postback occurs,,is dere any way i cant prevent this postback

+2  A: 

Try:

return false;
rodrigoap
i have tried this but its nt working
sumit
ohh my mistake,,its working,,thnx for ur reply
sumit
+3  A: 

Yes, you can do show(); return false; in the button's onclick handler.

Vinz
+2  A: 
onclick="show();return false;"
vsr
+1  A: 

Hi,

it's very simple: insert aber the "Alert('msg');" a "return false;".

so:

function show()
{
alert('Hallo');
return false;
 }
Kovu
This won't work! The return must be inside the onclick handler.
Vinz