window.showDialog 重写 window.open 重写 window.open 拦截

  1. var open_old=window.open; 
    var showModalDialog_old=window.showModalDialog; 
    /**FF中尚未经过测试**/ 
    window.open=function(sURL,windowName,features){ 
    try{url=sURL+’&LMDM=’+$(event.srcElement).attr(‘LMDM’);}catch(e){url=sURL} 
    open_old(url,windowName,features); 
    } 
    /**FF中尚未经过测试**/ 
    window.showModalDialog=function(sURL,vArguments,sFeatures){ 
    var url; 
    try{url=sURL+’&LMDM=’+$(event.srcElement).attr(‘LMDM’);}catch(e){url=sURL} 
    showModalDialog_old(url,vArguments,sFeatures); 
    }从前是可以正常使用的,但是现在好象不能用了。 
  2. <script type=“text/javascript”>  
  3. function showDialog(fun,titleStr,contentStr,num) {  
  4.           
  5.         num = (“” == num || null == num) ? 0 : num;  
  6.         if(null == document.getElementById(“dialog”+num))  
  7.         {  
  8.           
  9.             var dialog = document.createElement(“div”);  
  10.                 dialog.id = “dialog”+num;  
  11.             var p =document.createElement(“p”);  
  12.             var span = document.createElement(“span”);  
  13.                 span.setAttribute(“class”,“ui-icon ui-icon-alert”);  
  14.                 span.setAttribute(“style”,“float:left; margin:0 7px 20px 0;”);  
  15.                 document.body.appendChild(dialog);  
  16.                 dialog.appendChild(p);  
  17.                 p.innerHTML = contentStr;  
  18.                 p.appendChild(span);  
  19.                 $(‘#dialog’+num).dialog({  
  20.                         bgiframe: true,  
  21.                         resizable: false,  
  22.                         width: 300,  
  23.                         modal: true,  
  24.                         title: titleStr,  
  25.                         overlay: {  
  26.                             backgroundColor: ‘#000′,  
  27.                             opacity: 0.5  
  28.                         },  
  29.                         buttons: {  
  30.                             “取消”: function() {   
  31.                                 $(this).dialog(“close”);   
  32.                             },   
  33.                             “确定”: function() {  
  34.                                 if(null != fun)  
  35.                                 {  
  36.                                     fun;  
  37.                                 }  
  38.                                 $(this).dialog(“close”);   
  39.                             }   
  40.                         }  
  41.                     });  
  42.         }else{  
  43.             if(!$(‘#dialog’+num).dialog(‘isOpen’))  
  44.             {  
  45.                 $(“#dialog”+num).dialog(“open”);  
  46.                 return false;  
  47.             }  
  48.         }  
  49.           
  50. }  
  51. </script> 

 

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>