[html]window.open 使用示例

<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>父窗体</title>
    <style type="text/css">
        html{overflow-x: hidden;}
        body{overflow-x: hidden;}
    </style>
    <script type="text/javascript">
        function openWin() {
            //打开子窗体
            window.open('a2.html', '_blank', 'height=400px,width=750px');
        } 
    </script>
</head>
<body>
    <input type="text" value="123" id="x" />
    <a href="javascript:openWin()">类别2</a>
</body>
</html>
<!doctype html>
<html>
 <head>
  <meta charset="UTF-8">
  <title>子窗体</title>
  <script type="text/javascript">
    function onClick(){
        window.opener.document.getElementById('x').value = document.getElementById('y').value;
        window.close();
    };
  </script>
 </head>
 <body>
  <input type="text" value="1234" id="y" />
  <a href="#" onclick="onClick()">修改并关闭</a>
 </body>
</html>

在 IE、Chrome 测试通过。

posted on 2016-03-10 13:30  z5337  阅读(744)  评论(0编辑  收藏  举报