请有人帮帮我吗?以下javascript代码适用于IE9&上面的版本和Firefox也有,但较低版本的IE(8,7)不支持。
function SetName() {
var a = sessionStorage.getItem("sent");
var b = window.opener.document.getElementById("tclass").value;
var c = window.opener.document.getElementById("ttype").value;
var noPMMCode = window.opener.document.getElementById("noPMMCode").value;
var noLTMMCode = window.opener.document.getElementById("noLTMMCode").value;
var noLEMMCode = window.opener.document.getElementById("noLEMMCode").value;
var noSTMMCode = window.opener.document.getElementById("noSTMMCode").value;
if (window.opener != null && !window.opener.closed && b == "Material" && c == "PT" && noPMMCode != null) {
var txtName = window.opener.document.getElementById("PMMC" + a);
txtName.value = document.getElementById("ddlNames").value;
} else if (window.opener != null && !window.opener.closed && b == "Material" && c == "LT-NORMAL" && noLTMMCode != null) {
var txtName = window.opener.document.getElementById("LTMMC" + a);
txtName.value = document.getElementById("ddlNames").value;
} else if (window.opener != null && !window.opener.closed && b == "Material" && c == "LT-EMPANEL" && noLEMMCode != null) {
var txtName = window.opener.document.getElementById("LEMMC" + a);
txtName.value = document.getElementById("ddlNames").value;
} else if (window.opener != null && !window.opener.closed && b == "Material" && c == "ST" && noSTMMCode != null) {
var txtName = window.opener.document.getElementById("STMMC" + a);
txtName.value = document.getElementById("ddlNames").value;
}
window.close();
}
提前谢谢..
答案 0 :(得分:1)
window.opener在默认安全级别下无法在IE中工作。
一个选项是使用location.href将子窗口重定向到域中与父窗口相同的页面,然后使用window.opener