修改后警报不正常工作 [英] alert is not working proprly after modification

查看:56
本文介绍了修改后警报不正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了禁用阻止此页面创建其他对话,我的警报框已被jquery覆盖。



每当它发出警告时javascript执行应该停止并且应该在我们点击确定后继续。



但它不是发生现在而不是java脚本在我们点击确定之前就已经执行了。







 <   script     src   =  ../ js / jquery-ui.js     type   = < span class =code-keyword> text / javascript >  <  < span class =code-leadattribute> / script  >  
< link href = ../ css / jquery-ui.css rel = < span class =code-keyword> stylesheet type = text / css / >
< script type = text / javascript >
window.old_alert = window.alert;
window.alert = function(message,fallback){
if(fallback){
old_alert(message);
返回;
}
$(document.createElement('div'))
.attr({title:'<% =资源.LocalStrings.Alert %> ','class':'alert'})
.html(message)
.dialog({
按钮:{'<% = Resources.LocalStrings.Ok %> ':function (){$(this).dialog('close');}},
close:function(){$(this).remove();},
draggable:true,
模态:true,
可调整大小:true,
宽度:'250px'
});
};
< / script >

解决方案

(document.createElement('div'))
.attr({title:'<% = Resources.LocalStrings.Alert %> ','class':'alert'})
.html(message)
.dialog({
buttons:{'<% = Resources.LocalStrings.Ok %> ':function(){


(this).dialog('close');}},
close: function(){


(this).remove();},
draggable:true,
modal:true,
resizable:true,
宽度:'250px'
});
};
< / script >


in order to disable "prevent this page from creating additional dialogues" my alert box is over written by jquery .

whenever it alerts javascript execution should stop and should continue after we click ok.

but its not happening now instead java script is getting executed before we click ok.



<script src="../js/jquery-ui.js" type="text/javascript"></script>
      <link href="../css/jquery-ui.css" rel="stylesheet" type="text/css" />
      <script type="text/javascript">
          window.old_alert = window.alert;
          window.alert = function (message, fallback) {
              if (fallback) {
                  old_alert(message);
                  return;
              }
              $(document.createElement('div'))
      .attr({ title: '<%= Resources.LocalStrings.Alert %>', 'class': 'alert' })
      .html(message)
      .dialog({
          buttons: { '<%= Resources.LocalStrings.Ok %>': function () { $(this).dialog('close'); } },
          close: function () { $(this).remove(); },
          draggable: true,
          modal: true,
          resizable: true,
          width: '250px'
      });
          };
      </script>

解决方案

(document.createElement('div')) .attr({ title: '<%= Resources.LocalStrings.Alert %>', 'class': 'alert' }) .html(message) .dialog({ buttons: { '<%= Resources.LocalStrings.Ok %>': function () {


(this).dialog('close'); } }, close: function () {


(this).remove(); }, draggable: true, modal: true, resizable: true, width: '250px' }); }; </script>


这篇关于修改后警报不正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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