两个页面传参

用window.opener对象

index.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<title>Untitled Document</title>
	</head>
	<body>	
			your original data<input type="text">
<input type="button" value="get standard" onclick="get()"/>
<div id="msg"></div>
<input type="text" value="" id="standard" name="standard"/>
	<script>
function get(){

	window.open("child.html","child");	
}

		</script>
	</body>
</html>




child.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<title>Untitled Document</title>
	</head>
	<body>

<input type="text" name="standard" id="standard"/>
<input type="button" value="submit" onclick="getStandard()" />
<script >
function getStandard(){
	alert(window.opener.document);
	window.opener.document.getElementById('standard').value = document.getElementById('standard').value;
	window.opener.document.getElementById('msg').innerHTML = "success";
	window.close();
}

</script>
	</body>
</html>


你可能感兴趣的:(html)