日期:2014-05-16 浏览次数:20302 次
1、父页面father.html
?
?<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
? <head>
????
??? <title>将值返回父页面</title>
?<script type="text/javascript">
???? function acceptValueFromSon()
??? {?????????
???????????? window.open?('son.html','','status=no,scrollbars=no,top=20,
??????????????left=110,width=420,height=165');
???? }
?</script>
? </head>
?
? <body>
?? <input type="text" name="elementName" id="elementName"/>
?? <input type="button" value="跳到子页面" onclick="acceptValueFromSon();"/>
? </body>
</html>
?
2、子页面son.html
?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
? <head>
????
??? <title>将值返回父页面</title>
?<script type="text/javascript">
???? function returnValueToFather()
???? {
???????? var ValueToFather=document.getElementById("preturnValue").value;
???? ??? window.opener.document.getElementById("elementName").value=ValueToFather;
???????? window.close();
???? }
?</script>
? </head>
?
? <body>
?? <input type="text" name="preturnValue" id="preturnValue"/>
?? <input type="button" value="提交" onclick="returnValueToFather();"/>
? </body>
</html>
?
?
?
?
?