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();
}