如何本地化javascript确认弹出窗口的“确定"和“取消"按钮? [英] How to localize the OK and Cancel buttons of the javascript confirm popup?

查看:96
本文介绍了如何本地化javascript确认弹出窗口的“确定"和“取消"按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何以编程方式本地化javascript确认弹出窗口的确定"和取消"按钮?

解决方案

尝试此

< script language = " >
    功能 窗口 .confirm(str){
        execScript('  n = msgbox(' + str + ," 4132)' );
        返回(n ==  6 );
    }
</script> 


Internet Explorer中的确定/取消按钮将遵循 操作系统UI 语言设置.

技术原因是IE使用 MessageBox Win32 API 调用来显示其Javascript对话框.该API依赖于OS UI语言,而不依赖于浏览器UI语言,因为它归OS所有.

对于第三方浏览器,这实际上取决于他们是否使用MessageBox来显示其框.如果是,它将遵循操作系统语言,否则,将遵循浏览器UI语言.

有关更多信息,请参见此帖子:
http://stackoverflow. com/questions/1901745/do-browsers-localize-the-ok-and-cancel-buttons-of-the-javascript-confirm-popup [ 解决方案

try this

<script language="javascript">
    function window.confirm(str) {
        execScript('n = msgbox("' + str + '","4132")', "vbscript");
        return (n == 6);
    }
</script>


The OK/Cancel button in Internet Explorer will obey the Operating System UI language settings.

The technical reason is that IE is using the MessageBox Win32 API call to display its Javascript dialog box. That API relies on the OS UI language and not the browser UI language, as it is owned by the OS.

As for 3rd party browsers, it really depends if they are using MessageBox or not to display their box. If they are, it will obey to the Operating System language, if not, it will obey to the browser UI language.

See this post for more information:
http://stackoverflow.com/questions/1901745/do-browsers-localize-the-ok-and-cancel-buttons-of-the-javascript-confirm-popup[^]


这篇关于如何本地化javascript确认弹出窗口的“确定"和“取消"按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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