解决window.open传值的问题

1.html

<script type="text/javascript">
        function showItem() {
        
             var  win = window.open("2.html",null," height=300,width=450,  Left=300px,Top=20px, menubar=no,titlebar=no,scrollbar=no,toolbar=no, status=no,location=no");
        
        }
    </script>
    
        <input type="button" id="txtId"/>
        <input type="button" id="txtName"/>
        <input type="button" id="btnShow" onclick="showItem();"  value="显示子窗体"/>

2.html

 <script language="javascript" type="text/javascript">
       function check() {
    
              window.opener.document.getElementById("txtId").value="ID";
              window.opener.document.getElementById("txtName").value="NAME";
      }
    </script>
    
    <input type="button" id="btnSelect" onclick="check()"  value="选择"/>    

 

posted @ 2014-12-04 16:53  筱尘  阅读(653)  评论(0编辑  收藏  举报