雙擊域的實現:http://blog.csdn.net/gaopeng0071/article/details/21179619,
繼此篇博文,講述的雙擊域實現,在後續發現使用window.showModalDialog模態框存在瀏覽器安全色性問題。
使用chrome時,會出現模態框的返回值無法返回到父頁面,使用此種方式: window.returnValue
- 摘自:http://blog.csdn.net/luckzhang_la/article/details/17262421
這個方法存在瀏覽器安全色問題。採用ie核心的瀏覽器支援該方式,但採用Google核心的瀏覽器(如:Chrome)不支援。
不支援表現在window.showModalDialog()方法,採用Google核心的瀏覽器並不是開啟一個模式彈出框而是window.open()。這樣在彈出框裡設定返回值window.returnValue="返回值";在父表單擷取時var vReturnValue = window.showModalDialog(sURL [, vArguments] [, sFeatures])發現vReturnValue為undefined。
解決方案如下:
父頁面:
詳見其中第4行判斷與第7行判斷代碼。
function ondbGuanLianADId(){adId = window.showModalDialog('getAdForMac.action', null ,'dialogHeight=500px; dialogWidth=420px;');var strs = adId; if(strs==undefined){ strs=window.returnValue; }if(strs != undefined){document.getElementById("guanLianADId").value = strs.split(":")[0];document.getElementById("guanLianADName").value = strs.split(":")[1];}}子頁面:
function test(){// 解決IE與chrome瀏覽器版本差異問題 if (window.opener != undefined) { //for chrome window.opener.returnValue = document.getElementById("name1").value; } else { window.returnValue = document.getElementById("name1").value; }window.close();}
參考資源:http://blog.csdn.net/luckzhang_la/article/details/17262421