js页面传值


<!--将弹出来的子窗口的值传给父窗体
父窗口

-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  
	<script type="text/javascript">
		
		function openWindow() {
			var result  = window.showModalDialog("childen.html","DialogHeigth=40,DialogWidth:100px,location:no,menubar:no,toolbar:no,status:no");
			
			if(result)
				document.getElementsByName("content")[0].value=result;
		}

	</script>

 </HEAD>

 <BODY>
	<input type="button" value="打开新窗口" onclick="openWindow()">
	<hr>
	这是父窗口<br>
	<input type="text" name="content" >
 </BODY>
</HTML>





<!--子窗口-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  
	<script type="text/javascript">
		function execute() {
			window.returnValue = document.getElementsByName("content")[0].value;
			window.close();
		}
	</script>
 </HEAD>

 <BODY>
	<input type="text" name="content" value="这是子窗口">
	<input type="button" value="确定" onclick="execute()">
 </BODY>
</HTML>

你可能感兴趣的:(html)