문제

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?

도움이 되었습니까?

해결책

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;
 }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top