我打开一个子弹出窗口并从子窗口调用父函数。但我无法在IE8上这样做。我相信childwindow.onload
的问题还有其他选择吗?
父
function CallPopUp(rowindex,controlname ) {
var childWindow = open('test1.aspx', '1397127848655', 'resizable=no,width=700,height=500');
childWindow.onload = function () {
var hidden1 = childWindow.document.getElementById('hidden1');
var hidden2 = childWindow.document.getElementById('hidden2');
alert('asdas');
hidden1.innerHTML = rowindex;
hidden2.innerHTML = controlname;
}
}
儿童
<span id="hidden1"></span>
<span id="hidden2"></span>
<script language="javascript" type="text/javascript">
function updateParent(code, description) {
var id = document.getElementById('hidden1').innerHTML;
var controlname = document.getElementById('hidden2').innerHTML;
window.opener.setValue(id,controlname,code,description);
window.close();
return false;
}
$(document).on('click', '.submit', function () {
updateParent($(this).closest('tr').find('td:eq(0)').text(), $(this).closest('tr').find('td:eq(1)').text());
return false;
})
</script>
答案 0 :(得分:0)
尝试在onload
函数的末尾添加分号,例如:
function CallPopUp(rowindex,controlname ) {
var childWindow = open('test1.aspx', '1397127848655', 'resizable=no,width=700,height=500');
childWindow.onload = function () {
var hidden1 = childWindow.document.getElementById('hidden1');
var hidden2 = childWindow.document.getElementById('hidden2');
alert('asdas');
hidden1.innerHTML = rowindex;
hidden2.innerHTML = controlname;
};
}
之前我在IE8中遇到过类似的问题,而且还有这个问题。