Please find the error in below written code for asp + JavaScript
<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.
精彩评论