Javascript 确认弹出窗口是,否按钮而不是确定和取消 [英] Javascript Confirm popup Yes, No button instead of OK and Cancel

查看:24
本文介绍了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 确认弹出窗口是,否按钮而不是确定和取消的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆