任何人都可以帮助我将复选框ID传递给弹出窗口。我不知道如何在父窗口的中间创建一个弹出窗口。
代码:
var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true: false;
for (i = 0; i < newsletterall.length; i++) {
if (ie7 == false) {
newsletterall[i].childNodes[1].innerHTML = "";
newsletterall[i].childNodes[3].innerHTML = "";
newsletterall[i].childNodes[5].innerHTML = "";
newsletterall[i].childNodes[7].innerHTML = "";
newsletterall[i].childNodes[9].innerHTML = "";
newsletterall[i].childNodes[11].innerHTML = "";
newsletterall[i].childNodes[13].innerHTML = "";
} else {
newsletterall[i].childNodes[0].innerHTML = "";
newsletterall[i].childNodes[1].innerHTML = "";
newsletterall[i].childNodes[2].innerHTML = "";
newsletterall[i].childNodes[3].innerHTML = "";
newsletterall[i].childNodes[4].innerHTML = "";
newsletterall[i].childNodes[5].innerHTML = "";
newsletterall[i].childNodes[6].innerHTML = "";
}
content += "<input type='checkbox'id='compare" + i + "' name='list'><div id='article" + i + "'><a id='title" + i + "'href='" + hrefoftitle['name' + i] + "'>" + title['name' + i] + "<br></a>" + dateall['name' + i] + "<a href='" + hrefofauthor['name' + i] + "'>" + author['name' + i] + "</a><a href='" + hrefofexternal['name' + i] + "'>" + external['name' + i] + "</a><br>" + summary['name' + i] + "<br><a href='" + hrefofcomment['name' + i] + "'>" + comment['name' + i] + "</a><a href='" + hrefofexter['name' + i] + "'>" + exter['name' + i] + "</a></div></input>";
}
content += "<input type='button' name='goto' onclick='popup1()' value='Check'></form>";
if (ie7 == false) {
newsletterall[0].childNodes[1].innerHTML = content;
} else {
newsletterall[0].childNodes[0].innerHTML = content;
}
我已经创建了复选框。现在我需要在中间创建一个弹出窗口并获取复选框的值并显示它。
答案 0 :(得分:0)
要访问父窗口的对象,子窗口(例如弹出窗口)对象上有一个名为opener的属性。
var parentWindow = window.opener;
使用该对象,您应该能够访问父窗口的表单。
var value = parentWindow.document.getElementById("compare").value;