Javascript 确认弹出窗口是,否按钮而不是确定和取消
Javascript Confirm 弹出窗口,我想显示 Yes, No 按钮而不是 OK 和 Cancel.
Javascript Confirm popup, I want to show Yes, No button instead of OK and Cancel.
我用过这个vbscript代码:
I have used this vbscript code:
<script language="javascript">
function window.confirm(str) {
execScript('n = msgbox("' + str + '","4132")', "vbscript");
return (n == 6);
}
</script>
这仅适用于 IE,在 FF 和 Chrome 中,它不起作用.
this only works in IE, In FF and Chrome, it doesn't work.
是否有任何解决方法可以在 Javascript 中实现这一点?
Is there any workround to achieve this in Javascript?
我还想更改弹出窗口的标题,例如在 IE 中显示Windows Internet Explorer",我想在此处显示我自己的应用程序名称.
I also want to change the title of popup like in IE 'Windows Internet Explorer' is shown, I want to show here my own application name.
推荐答案
不幸的是,没有跨浏览器支持打开不是默认确定/取消对的确认对话框.您提供的解决方案使用的是 VBScript,它只在 IE 中可用.
Unfortunately, there is no cross-browser support for opening a confirmation dialog that is not the default OK/Cancel pair. The solution you provided uses VBScript, which is only available in IE.
我建议使用可以构建基于 DOM 的对话框的 Javascript 库.试用 Jquery 用户界面:http://jqueryui.com/
I would suggest using a Javascript library that can build a DOM-based dialog instead. Try Jquery UI: http://jqueryui.com/
相关文章