Javascript Confirm popup Yes, No button instead of OK and Cancel(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/
这篇关于Javascript 确认弹出窗口是,否按钮而不是确定和取消的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Javascript 确认弹出窗口是,否按钮而不是确定和取消


基础教程推荐
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01