Pergunta

eu tenho um Javascript função

show()
{
alert("hello");
}

que é executado no evento de botão ASP OnClick.

Quando clico no botão da caixa de mensagem de alerta mostrando "Hello", ocorre o postback. Existe alguma maneira de impedir este postback?

Foi útil?

Solução

Tentar:

return false;

Outras dicas

Sim você pode fazer show(); return false; No manipulador OnClick do botão.

onclick="show();return false;"

É muito simples: insira Aber o "alerta ('msg');" um "retorno falso;".

assim:

function show()
{
alert('Hallo');
return false;
 }
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top