自定义确认对话框 [英] Customized Confirm Dialog

查看:94
本文介绍了自定义确认对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://www.w3schools.com/jsref/met_win_confirm.asp 中描述的确认对话框[ ^ ]包含是和否按钮。现在,我需要自定义2个按钮的单词。例如,是的措辞为Do xxx,否的措辞为Do yyy。怎么做?谢谢,如果你能提供帮助。

The Confirm dialog described in http://www.w3schools.com/jsref/met_win_confirm.asp[^] contains Yes and No buttons. Now, I need to customize the words of the 2 buttons. For instance the 'Yes' is worded as 'Do xxx' and 'No' is worded as 'Do yyy'. How to do it? Thanks if you can help.

推荐答案

你不能用确认方法做到这一点,所以有两种选择:

You cannot do this with the confirm method, so there are two options:


  1. 创建自己的对话框。
  2. 查找包含对话框的库。例如, jQuery UI支持模态对话框 [ ^ ]。

  1. Create your own dialog.
  2. Look for a library that contains dialogs. For example, jQuery UI has support for modal dialogs[^].


您引用的链接是内置的confirm()函数。你无法改变它。



你想要做的是google for jQuery对话框的例子。它们有吨和吨。或者您可以构建自己的div并使用JS来执行此操作,但是有很多很好的jQuery插件可以使对话框变得容易。
The link you referred to is the built-in confirm() function. You cannot change that.

What you'll want to do is google for jQuery dialog examples. There are tons and tons of them. Or you can just build your own div and use JS to do it but there are lots of nice jQuery plugins that make dialogs easy to do.


这个嵌入式JavaScrip对话框有两个问题:pop页面上的(不方便),看起来很难看,取决于浏览器/系统并且不灵活。



一个更好的解决方案是实现模态的jQuery UI对话框页面内的行为: https://jqueryui.com/dialog [ ^ ]。



您还可以使用众多第三方jQuery UI插件之一基于类似的原则,并提供各种视觉效果和选项,特别是,调整页面的其余部分。这些解决方案通常用通用名称模态弹出窗口引用。您会发现它们的数量不足: http://bit.ly/1DpajUJ [ ^ ]。




恭喜4月1日! :-)



我想利用这个机会邀请大家看一下我4月份新发布的1并有一些乐趣:



某些编程方法神经语言程序设计

特别鼓励在评论和讨论中参与此游戏。



谢谢。

-SA
This embedded JavaScrip dialog has two problems: it pop-ups over the page (inconvenient), looks ugly, depends on the browser/system and is not flexible.

One better solution is the jQuery UI dialog which implement modal behavior within the page: https://jqueryui.com/dialog[^].

You can also use one of the many 3rd-party jQuery UI plug-ins based on similar principle and offering all kinds of visual effects and options, notably, dimming the rest of the page. Such solutions are usually referred by the common name "modal popup" You will find more than enough of them: http://bit.ly/1DpajUJ[^].


Congratulations with 1st of April! :-)

I would like to use the occasion to invite everyone to see my new 1 of April publication and have some fun:

Some Programming Approaches to "Neuro-Linguistic Programming".
Participation in this game in Comments and Discussions is especially encouraged.

Thank you.
—SA


这篇关于自定义确认对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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