标签:
父窗口: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>
标签:
原文地址:http://www.cnblogs.com/sdu-Jumper/p/4757754.html