请问从一个窗口中弹出另一个窗口,父窗口如何控制子窗口,子窗口如何控制父窗口?给分!!!!

m2002 2002-01-22 05:45:52
...全文
61 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
m2002 2002-01-23
  • 打赏
  • 举报
回复
以上方法的确可以实现。但是我用父窗口无法控制子窗口,无法对子窗口对象赋值,请示下:
父窗口:
<html>
<head>
<script language="JavaScript">
var childWin;
function aa(){
childWin=window.open("b.html");
childwin.document.form2.input.value="dfdsf";
}
function ab(){


childwin.document.form2.input.value="dfdsf";
childwin.document.form2.write.value="写入";


}

</script>

<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="100%" border="0">
<tr><form name="form1" method="post" action="">
<td width="60%">

<input type="button" name="open" value="弹出" onclick="aa()">


</td>
<td width="40%">

<input type="button" value="输入" name="write" onclick="ab()">
<input type="text" name="textfield" value="">


</td></form>
</tr>
</table>
</body>
</html>
子窗口:
<html>
<head>
<script language="JavaScript">
function aa(){
window.opener.document.form1.open.value="open";
window.opener.document.form1.write.value="write";
window.opener.document.form1.textfield.value="输入";
}


</script>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="100%" border="0">
<tr><form name="form2" method="post" action="">
<td>

<input type="button" value="输入" name="write" onclick="aa()">



</td>
<td> <input type="text" name="input" value=""></td>
</form></tr>
</table>
</body>
</html>
孟子E章 2002-01-22
  • 打赏
  • 举报
回复
childWin.document.fname.inputname.value="hehe"
孟子E章 2002-01-22
  • 打赏
  • 举报
回复
var childWin =window.open("")
childWin.location="http://lucky.myrice.com"


zai child里:
window.opener.document.fname.input1.value="haha"

87,996

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧