HTML 父窗口打开子窗口,并从子窗口返回值
父窗口:windowdemo.html
<html>
<head>
<title> 接收子窗口返回的内容 </title>
<script language="JavaScript">
function shownewpage(thisurl)
{ window.open('content.html','content','width=480,height=330,top=150,left=280, toolbar=no, menubar=no, scrollbars=auto, resizable=no, location=no, status=no'); }
</script>
</head>
<body> <form action="" method="post" name="parentform"> <input type="button" value="选择信息" onclick="shownewpage('content.html');"> <br> 选择的结果:<input type="text" name="result"/>
</form>
</body>
</html>
子窗口: cntent.html
<html>
<head>
<title>返回内容 </title>
<script language="JavaScript">
function returnValue()
{ var city=document.myform.city.value var doc=window.opener.document; doc.parentform.result.value=city; window.close(); }
</script>
</head>
<body>
<form name="myform" >
选择:
<select name="city">
<option value="北京">北京</option>
<option value="天津">天津</option> </select>
<input type="button" value="返回" onclick="returnValue()">
</form> </body> </html>