首页 > Windows开发 > 详细

网页中window.open 弹出 父页面和子页面数值交互

时间:2016-11-15 00:29:01      阅读:235      评论:0      收藏:0      [点我收藏+]

//首先建立一个父页面

<!doctype html>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>父页面</title>

<script>

  function tanchu(){

    window.open("son.html","ziyemian","width=300,height=400,top=200,left=300,toobar=no,menubar=no,scrollbars=no,location=no,status=no");

  }

  function reTurn(){

    return document.getElementById("aaa");

  }

</script>

</head>

<body>

  <input value="提交" id ="button" type="button" onclick="tanchu()"/>

  <input type="text" id="bbb">

  <input type="text" id="ddd" value="123456">

</body>

</html>

 

//son.html

<!doctype html>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html;charset=utf-8">

<title>子页面</title>

</head>

<body>

  <script>

    function aaa(){

      window.opener.document.getElementById("bbb").value="123123123";//向父页面传值

      //获取父级页面的的值

      //window.opener.a();   调用父级页面的方法

      alert(window.opener.a().value);

    }

  </script>

  <input type="button" id="button" value="提交" onclick="aaa()">

</body>

</html>

网页中window.open 弹出 父页面和子页面数值交互

原文:http://www.cnblogs.com/Super-Zhen-/p/6063942.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!