开发者

AVoid Postback on OnClick Event

开发者 https://www.devze.com 2022-12-12 12:32 出处:网络
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 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开发者_如何学Python prevent this postback?


Try:

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;
 }
0

精彩评论

暂无评论...
验证码 换一张
取 消