Are custom buttons possible in an alert box?

孤街浪徒 提交于 2019-12-23 15:50:47

问题


Hi I have been looking to create custom buttons in an alert box I would like them to say Go and Cancel instead of OK and cancel

onClick="if(confirm('Would you like to continue?'))

回答1:


No, there is no cross-browser support for opening a confirmation dialog that is not the default OK/Cancel pair, but you can build them with JavaScript such as jQuery Alert Dialogs, jQuery impromptu, Mootools LightFace and many more.




回答2:


You can't, as far I know. The button caption are not customizable by design.

It is needed to avoid possible fraud (think what can happen if you switch the caption of confirm and cancel buttons).




回答3:


With this its possible,

http://www.codeproject.com/Articles/28812/Custom-Alert-Boxes-using-JavaScript-and-the-DOM



来源:https://stackoverflow.com/questions/5046754/are-custom-buttons-possible-in-an-alert-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!