JavaScript:如何选择“取消”默认情况下在确认框中? [英] JavaScript: How to select "Cancel" by default in confirm box?

查看:130
本文介绍了JavaScript:如何选择“取消”默认情况下在确认框中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户点击删除数据按钮时,我正在显示一个JavaScript确认框。我正在显示它,如下图所示:

I am displaying a JavaScript confirm box when the user clicks on the "Delete Data" button. I am displaying it as shown in this image:

在图像中,默认选择确定按钮。我想默认选择取消按钮,这样如果用户意外按下输入键,记录将是安全的,不会被删除。

In the image, the "OK" button is selected by default. I want to select the "Cancel" button by default, so that if the user accidentally presses the enter key, the records will be safe and will not be deleted.

在JavaScript中有没有办法默认选择取消按钮?

Is there any way in JavaScript to select the "Cancel" button by default?

推荐答案

如果可以的话使用jQuery插件然后在这里是一个很好的一个

If you can use jQuery plugin then here is a nice one

jQuery的即兴

要更改默认的焦点按钮:

To change the default focused button:

$.prompt('Example 4',{ buttons: { Ok: true, Cancel: false }, focus: 1 });

这篇关于JavaScript:如何选择“取消”默认情况下在确认框中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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