Chrome v37不支持showModalDialog返回值
在Chrome中showModalDialog不能正常工作。可以使用open()方法代替,以下为部分代码:
方案一:
父页面:
function selectStore(){
var returnValue = window.open("${ctx}/site/store/selstore","门店选择","dialogHeight:500px;dialogWidth:900px;location:no");
if (returnValue == undefined) {
returnValue = window.returnValue;
$("#storeName").val(returnValue[0].toString());
$("#storeId").val(returnValue[1].toString());
}
}
子页面:
function confirm()
{
var store = $('input[type^=radio]:checked').attr("store");
var value = $('input[type^=radio]:checked').attr("value");
var ret = new Array(store,value);
if(window.opener!=undefined)
{
window.opener.document.getElementById("storeName").value = store;
window.opener.document.getElementById("storeId").value = value;
}else{
window.returnValue = ret;
}
window.close();
}
方案二:使用JBox插件
function selectStore(){
top.$.jBox.open("iframe:url","选择门店",810,$(top.document).height()-150,
{
submit:function(v, h, f)
{
var rgv=h.find("iframe")[0].contentWindow.document.getElementById("radioGroup").value;
var rgn=h.find("iframe")[0].contentWindow.document.getElementById("radioGroup").name;
$("#storeName").val(rgn);
$("#storeId").val(rgv);
},
loaded:function(h){
$(".jbox-content", top.document).css("overflow-y","hidden");
}
});
}