ASP.NET coding in VB.NET -- web application. I am asking a few questions about the "proper way" to set the OnClientClick phrase in the aspx button declaration.
Option 1: leading with 'javascript:' and surrounding the js in {...}
<asp:Button ID="btnDelete" runat="server" CausesValidation="False" SkinID="cmdButton" style="margin-left: 2em;"
CommandName="Delete" Text="Delete"
OnClientClick = "javascript:{(!confirm('Do you want to delete this record?'); return false;}"
Option 2: Not leading with 'javascript:' and NOT surrounding the js in {...}
<asp:Button ID="btnDelete" runat="server" CausesValidation="False" SkinID="cmdButton" style="margin-left: 2em;"
CommandName="Delete" Text="Delete"
OnClientClick="if (!confirm('Do you want to delete this record?')) return false;"
Both options appear to work properly in IE-10, but have not tried other browsers. So I am curious about the different phrases.
What about the leading of 'javascript:'? -- what affect does this have?
What about the surrounding of the js with {...} -- what affect does this have?
Your comments are welcome -- what is the best way to construct the phrase.
Any other syntax (or style) or suggestions will be welcome.
Thanks, in advance...John