javascript - How to set the OnClientClick value - syntax? -


asp.net coding in vb.net -- web application. asking few questions "proper way" set onclientclick phrase in aspx button declaration.

option 1: leading 'javascript:' , surrounding js in {...}

<asp:button id="btndelete" runat="server" causesvalidation="false"  skinid="cmdbutton" style="margin-left: 2em;"    commandname="delete" text="delete"     onclientclick = "javascript:{(!confirm('do want delete record?'); return false;}" 

option 2: not leading 'javascript:' , not surrounding js in {...}

<asp:button id="btndelete" runat="server" causesvalidation="false"  skinid="cmdbutton" style="margin-left: 2em;"    commandname="delete" text="delete"     onclientclick="if (!confirm('do want delete record?')) return false;" 

both options appear work in ie-10, have not tried other browsers. curious different phrases.

what leading of 'javascript:'? -- affect have?

what surrounding of js {...} -- affect have?

your comments welcome -- best way construct phrase.

any other syntax (or style) or suggestions welcome.

thanks, in advance...john

onclientclick renders standard html onclick attribute, put whatever works it.

i.e. - no javascript prefix required, no brackets required well.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -