简体   繁体   English

javascript确认框

[英]javascript confirmation box

In javascript,guide me to display a confirm box with button such as "Yes" and "No" instead of "Ok" and "Cancel". 在javascript中,引导我显示带有“是”和“否”按钮的确认框,而不是“确定”和“取消”按钮。

thanks in advance... 提前致谢...

The button text in the "confirm" box is dependent on the browser local. “确认”框中的按钮文本取决于浏览器本地。 There's no way to change them. 无法更改它们。 There is no easy way to create a popup fully in javascript with the same functionality. 没有简单的方法可以完全使用javascript创建具有相同功能的弹出窗口。

If you're using jQuery, you can have a look at this modal confirmation dialog example. 如果您使用的是jQuery,则可以查看此模式确认对话框示例。

Otherwise, I advise to reformulate the question and stick with the javascript "confirm" box. 否则,建议重新制定问题,并使用javascript“确认”框。

suppose you say var x=confirm("Do you want to continue"); 假设您说var x = confirm(“是否要继续”);

You can't. 你不能 The look and the buttons of the JavaScript alert, confirm and prompt boxes are controlled strictly by the browser's type and version and by the Operating System. JavaScript警报,确认和提示框的外观和按钮严格受浏览器的类型和版本以及操作系统的控制。

Well it is true that you may create, graphically, a div which could look like and create a code to make it act almost like a confirm box, case in which you may design whichever buttons you want. 确实,您可以通过图形方式创建一个看起来像div的div,并创建代码以使其几乎像一个确认框,在这种情况下,您可以设计所需的任何按钮。 But you will never be able to make it work in the same synchronous manner as a real confirm box, which means you will miss the main functionality of a confirm. 但是,您将永远无法使其与真正的确认框以相同的同步方式工作,这意味着您将错过确认的主要功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM