Salut。 我已经证明与Firefox的IE浏览器。window.opener不同按钮和输入类型=按钮
如果从按钮调用paginaH1.html(功能openSon)(window.opener无法正常工作)。
如果你从input type = button调用工作。
如果单击按钮不起作用(A0-ObjectWindow,A1-未定义)。
如果单击输入类型= '按钮' 工作(A0-ObjectWindow,A1-ObjectHTMLElement)。
这是页面揭幕战:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>prueba-Father</title>
<script type="text/javascript">
function openSon() {
window.datoPField = document.frmName.campoPadre;
alert(window.datoPField+' ahora abro hijo');
a=window.open('paginaH1.html');
}
</script>
</head>
<body>
<form name="frmName">
<h1 id="text">Comunicacion entre dos paginas con Javascript.</h1>
<input type="text" name="campoPadre" id="campoPadre" value="delPadre" >
<input type="button" onClick="openSon()" value="input-button">
<button onClick="openSon()">button</button>
<button onClick="window.datoPField = document.getElementById('campoPadre'); a=window.open('paginaH1.html');">bt+getElement</button>
</form>
</body>
</html>
现在pagninaH1.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Son page</title>
<script type="text/javascript">
function iniciar() {
alert(0);
alert("a0-"+window.opener);
alert("a1-"+window.opener.datoPField);
alert("b0-"+window.opener.frmName.campoPadre);
alert("c0-"+window.opener.datoPField.value);
this.datoField = opener.datoPField;
alert("d0-"+this.datoField);
}
</script>
</head>
<body ONLOAD="iniciar()">
<h1 id="text">esta es la pagina hijo </h1>
<button onclick="this.window.close();">Cerrar</button>
</body>
</html>
感谢。
Thansk,非常感谢