开发者

Please find the error in below written code for asp + JavaScript

开发者 https://www.devze.com 2023-01-31 09:52 出处:网络
<script type=text/javascript> function abc() { return confirm(\'Are u sure\'); } </script> <asp: Button id="btnSubmit" runat="server" onClick="btnSubmit_Click
<script type=text/javascript>
function abc()
{
   return confirm('Are u sure');
}
</script>


<asp: Button id="btnSubmit" runat="server" onClick="btnSubmit_Click" onClientClick="abc" Text="Submit/>

When I click the button the message box appears 开发者_JAVA百科if I hit the cancel Button still the function for onClick is called instead it should not. But if I write JavaScript code directly in the tag it works properly.


onClientClick="return abc()"

the return is the essential bit.

0

精彩评论

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

关注公众号