<bdo id='0Ybw3'></bdo><ul id='0Ybw3'></ul>

  • <tfoot id='0Ybw3'></tfoot>

    1. <small id='0Ybw3'></small><noframes id='0Ybw3'>

        <legend id='0Ybw3'><style id='0Ybw3'><dir id='0Ybw3'><q id='0Ybw3'></q></dir></style></legend>

      1. <i id='0Ybw3'><tr id='0Ybw3'><dt id='0Ybw3'><q id='0Ybw3'><span id='0Ybw3'><b id='0Ybw3'><form id='0Ybw3'><ins id='0Ybw3'></ins><ul id='0Ybw3'></ul><sub id='0Ybw3'></sub></form><legend id='0Ybw3'></legend><bdo id='0Ybw3'><pre id='0Ybw3'><center id='0Ybw3'></center></pre></bdo></b><th id='0Ybw3'></th></span></q></dt></tr></i><div id='0Ybw3'><tfoot id='0Ybw3'></tfoot><dl id='0Ybw3'><fieldset id='0Ybw3'></fieldset></dl></div>

        如何个性化警报按钮 - window.confirm() 和 window.alert()

        How to personalize alert buttons - window.confirm() and window.alert()(如何个性化警报按钮 - window.confirm() 和 window.alert())
      2. <i id='9K1il'><tr id='9K1il'><dt id='9K1il'><q id='9K1il'><span id='9K1il'><b id='9K1il'><form id='9K1il'><ins id='9K1il'></ins><ul id='9K1il'></ul><sub id='9K1il'></sub></form><legend id='9K1il'></legend><bdo id='9K1il'><pre id='9K1il'><center id='9K1il'></center></pre></bdo></b><th id='9K1il'></th></span></q></dt></tr></i><div id='9K1il'><tfoot id='9K1il'></tfoot><dl id='9K1il'><fieldset id='9K1il'></fieldset></dl></div>

          <bdo id='9K1il'></bdo><ul id='9K1il'></ul>

                  <small id='9K1il'></small><noframes id='9K1il'>

                  <tfoot id='9K1il'></tfoot>
                    <tbody id='9K1il'></tbody>

                  <legend id='9K1il'><style id='9K1il'><dir id='9K1il'><q id='9K1il'></q></dir></style></legend>
                1. 本文介绍了如何个性化警报按钮 - window.confirm() 和 window.alert()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我看到许多网站都使用不同的按钮文本来个性化他们的警报和确认框.

                  默认情况下,这是 JavaScript window.confirm() 函数将输出的内容:

                  +-----------------------------+|网页留言|+------------------------------+|弹出文字 ||||||||||[确定] [取消] |+------------------------------+

                  但是,如果我想要自定义标题文本和自定义按钮文本等自定义内容怎么办?

                  +-----------------------------+|我的自定义标题 |+------------------------------+|弹出文字 ||||||||||[你好] [再见] |+------------------------------+

                  这可以用 JavaScript、Jquery 或 AJAX(或其他语言)实现吗?如果是这样,你能给我举个例子吗?谢谢!

                  解决方案

                  我不会在这里发现任何新东西.创建的评论说明了所有最相关的信息.

                  您应该查看具有强大支持且易于定制的开源替代方案.看看 (包括js、css等)

                2. 解压文件.
                3. 然后复制并粘贴示例代码并将其保存为example.html或任何你想要的.
                4. 现在更改链接,使其指向您下载的文件(查看我如何更改我的文件)
                5. 保存文件并使用您喜欢的浏览器对其进行测试.
                6. 我刚刚做了,效果很好!(在 Firefox 和 Chromium 下)

                  注意:我用新版本的 BootStrap (v.3) 对其进行了测试,但它不起作用.

                  I have seen many websites that have personalized their alert and confirmation boxes with different button text.

                  By default, this is what the JavaScript window.confirm() function would output:

                  +-----------------------------+
                  |Message from webpage         |
                  +-----------------------------+
                  |Popup text                   |
                  |                             |
                  |                             |
                  |                             |
                  |                             |
                  |   [Ok]     [Cancel]         |
                  +-----------------------------+
                  

                  But, what if I wanted some customization like custom header text, and custom button text?

                  +-----------------------------+
                  |My custom Header             |
                  +-----------------------------+
                  |Popup text                   |
                  |                             |
                  |                             |
                  |                             |
                  |                             |
                  |   [HELLO]     [GOODBYE]     |
                  +-----------------------------+
                  

                  Can this be achieved in JavaScript, Jquery, or AJAX (or another language)? If so, could you please show me an example? Thanks!

                  解决方案

                  I wont discover anything new here. And the comments created say all the most relevant information.

                  You should look at open source alternatives that have great support and are easy to customize. Take a look at BootBoxJS (it depends on jQuery).

                  In that site you can find examples of alerts, dialogs, and other useful tools. e.g.

                  To use the mentioned soft:

                  1. Download the js library compressed (including js, css, etc)
                  2. Unzip the file whatever you want to.
                  3. Then copy and paste the example code and save this as example.html or whatever you want to.
                  4. Now change the links to make it point to your downloaded files (see how I changed my file)
                  5. Save the file and test it with your preferred browser.

                  I just did it and it works perfect! (Under Firefox and Chromium)

                  NOTE: I tested it with the new version of BootStrap (v.3) and it doesn't work.

                  这篇关于如何个性化警报按钮 - window.confirm() 和 window.alert()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  append() 方法在被选元素的结尾(仍然在内部)插入指定内容。 语法: $(selector).append( content ) var creatPrintList = function(data){ var innerHtml = ""; for(var i =0;i data.length;i++){ innerHtml +="li class='contentLi'"; innerHtml +="a href
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                  Ordinals in words javascript(javascript中的序数)
                      <tbody id='7rNKr'></tbody>

                  1. <small id='7rNKr'></small><noframes id='7rNKr'>

                        <i id='7rNKr'><tr id='7rNKr'><dt id='7rNKr'><q id='7rNKr'><span id='7rNKr'><b id='7rNKr'><form id='7rNKr'><ins id='7rNKr'></ins><ul id='7rNKr'></ul><sub id='7rNKr'></sub></form><legend id='7rNKr'></legend><bdo id='7rNKr'><pre id='7rNKr'><center id='7rNKr'></center></pre></bdo></b><th id='7rNKr'></th></span></q></dt></tr></i><div id='7rNKr'><tfoot id='7rNKr'></tfoot><dl id='7rNKr'><fieldset id='7rNKr'></fieldset></dl></div>
                        <legend id='7rNKr'><style id='7rNKr'><dir id='7rNKr'><q id='7rNKr'></q></dir></style></legend>
                          <tfoot id='7rNKr'></tfoot>
                          • <bdo id='7rNKr'></bdo><ul id='7rNKr'></ul>