【问题标题】:Center alertbox and change 'Javascript' text in the alertbox居中警报框并更改警报框中的“Javascript”文本
【发布时间】:2013-10-05 17:37:31
【问题描述】:

如何将警告框放置在浏览器的中心,是否可以将警告框中的“Javascript”文本更改为“页面重新加载”之类的内容

$('#reload').click(function(e) {
   if (confirm('Are you sure')) window.location.reload()
});

http://jsfiddle.net/wvNrC/1/

【问题讨论】:

标签: javascript google-chrome


【解决方案1】:

您可以使用 jQuery UI 对话框小部件...

$(document).ready(function () {

  $("#dialog").dialog({
    modal: true,
    bgiframe: true,
    width: 500,
    height: 200,
    autoOpen: false
  });

  $("#reload").click(function (e) {
    e.preventDefault();

    $("#dialog").dialog('option', 'buttons', {
      "Confirm": function () {
        window.location.reload();
      },
      "Cancel": function () {
        $(this).dialog("close");
      }
    });

    $("#dialog").dialog("open");

  });

});

js fiddle

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-10-07
    • 2016-12-01
    • 2020-10-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-27
    • 1970-01-01
    • 2010-10-02
    相关资源
    最近更新 更多