admin管理员组文章数量:1426087
I am familiar with the basic JavaScript confirm function. I want to take one step further: instead of having a message box pop up with the options of "OK" and "Cancel", I would like to add three options and change the dialog so that the three choices read "Confirm", "Deny", and "cancel". A "Confirm" or "Deny" choice would each call a different function. Any suggestions on how to do this?
I am not using JQuery or any other library, and i really don't want to use any if I can help it, as it's just this one function. Any help would be appreciated.
I am familiar with the basic JavaScript confirm function. I want to take one step further: instead of having a message box pop up with the options of "OK" and "Cancel", I would like to add three options and change the dialog so that the three choices read "Confirm", "Deny", and "cancel". A "Confirm" or "Deny" choice would each call a different function. Any suggestions on how to do this?
I am not using JQuery or any other library, and i really don't want to use any if I can help it, as it's just this one function. Any help would be appreciated.
Share Improve this question asked Jul 28, 2011 at 17:59 AnonymousAnonymous 211 silver badge2 bronze badges 2- Dup: stackoverflow./questions/1800033/… – Ray Toal Commented Jul 28, 2011 at 18:01
- Possible duplicate of how to show confirmation alert with three buttons 'Yes' 'No' and 'Cancel' as it shows in MS Word – David Millar Commented Mar 8, 2017 at 21:43
2 Answers
Reset to default 2You will want to look into making a custom dialog from a div, and assign click events to the buttons. You can't modify the browser's standard dialogs without using VBScript which is IE only.
The fact that you don't want to use JQuery is quite silly. It's 31k and the best thing to ever happen to JavaScript.
If you want to avoid JQueryUI, you can create a dialog yourself very easily. Here's a tutorial to get you started: http://www.queness./post/1696/create-a-beautiful-looking-custom-dialog-box-with-jquery-and-css3
AFAIK, you cannot change the button prompt strings with just using pure JS. It has to be 'OK' and 'Cancel'.
本文标签: 39Yes3939No39and Cancel with JavaScript confirm functionStack Overflow
版权声明:本文标题:'Yes', 'No', and Cancel with JavaScript confirm function - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745406803a2657286.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论