OnClientClick return confirm() in ajax environment , event lose

Confirm function on button. We are use OnClientClick="return confirm('Are you sure')" often.

but that is no correct under Ajax. because the real code is Generate return confirm('Are you sure'); __doPostBack('ctl00$ContentPlaceHolder1$lbRestore','')
because the button is normal button and use onclick event no submit type.

So the event is lose.


Please use


if (!confirm('Are you sure?')){return false;}
posted @ 2009-12-22 12:33  阿新  阅读(502)  评论(0编辑  收藏  举报