How to create a yes / no / cancel field in javascript instead of ok / cancel?

How to create a yes / no / cancel warning window instead of an OK / Cancel window in Javascript?

+6
javascript
Jun 24 '10 at 14:23
source share
3 answers

You can not.

Instead, you can use a fake dialog library such as jQuery UI Dialog .

These libraries create HTML elements that look and behave like a dialog box, allowing you to embed anything you want (including form or video elements) in the dialog box.

+9
Jun 24 '10 at 14:25
source share

There is nothing built in for this. You can use the framework to simulate, for example: http://www.sencha.com/deploy/dev/docs/?class=Ext.MessageBox

0
Jun 24 2018-10-06T00:
source share

This will work in IE, but as for other browsers, I'm not sure. It is important to note that yes / no / cancel is not officially supported by Javascript, so you are better off using ok / cancel where possible.

<script language=javascript> /*@cc_on @*/ /*@if (@_win32 && @_jscript_version>=5) function window.confirm(str) { execScript('n = msgbox("'+str+'","4132")', "vbscript"); return(n == 6); } @end @*/ var r = confirm("Can you do it?"); alert(r); </script> 
0
Jun 24 2018-10-06T00:
source share



All Articles