window.showModalDialog()方法在Chrome下不能使用的解決方法

1、用window.open()替代其彈出窗口


2、用 getBrowserType() 判斷當前瀏覽器是什麼瀏覽器,並作出相應處理。


function getBrowserType() {


   var ua = navigator.userAgent.toLowerCase();


  if(ua.match(/msie ([\d.]+)/))return 1;


  if(ua.match(/firefox\/([\d.]+)/))return 2;


  if(ua.match(/chrome\/([\\d.]+)/))return 3;


  if(ua.match(/opera.([\d.]+)/))return 4;


  if(ua.match(/version\\/([\d.]+).*safari/))return 5;


  return 0;


}


3、IE用window.returnValue 向父窗口傳遞參數;


Chrome用window.opener.returnValue向父窗口傳遞參數,並且調用 window.opener.document.all.btnGetList.click();局部舒心父窗口。


4、在父窗口定義一個控件<input type="hidden" id="btnGetList" οnclick="<%=PostBack()%>" />


5、在父窗口的後臺定義PostBack()方法


      protected string PostBack()    


{        


return this.Page.GetPostBackEventReference(this.hidAdd, "getList");    





hidAdd觸發下面事件


    protected void btnAdd_Click(object sender, EventArgs e)    


{      


 this.GetList();  


}
發佈了95 篇原創文章 · 獲贊 40 · 訪問量 88萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章