zoukankan      html  css  js  c++  java
  • js子窗口向父窗口传值

    用opener

    这是一个父窗口~

    <html>
    <head>
    <title>
    </title>
    <script language="javascript">
    function win(){
       window.open("login.html",null,"height=150,width=200");
    }

    </script>
    </head>
    <table id="t1">
    <tr><td id="dd">user</td></tr>
    <tr><td id="bb">sex</td></tr>
    </table>
    <input type="button" value="提交" onclick="win()"/>
    </html>

    下面是一个子窗口

    <html>
    <head>
    <title>
    </title>
    <script language="javascript">
    function win(){

       window.opener.document.all.dd.innerText=document.getElementByIdx("user").value;
       window.opener.document.all.bb.innerText=document.getElementByIdx("sex").value;

       window.close();
    }

    </script>
    </head>
    <body>
    user:
    <input type="text" name="user"/>
    <br>sex:
    <input type="text" name="sex"/>
    <br>
    <input type="button" value="提交" onclick="win()"/>
    </body>
    </html>

  • 相关阅读:
    包装类
    String、Date、Calendar的转换
    枚举enum
    mybatis纵览
    postman编程
    postman导出Collection文件
    host头攻击
    maven处理jar包冲突
    jdk版本与项目依赖jar包不兼容
    linux安装jdk脚本
  • 原文地址:https://www.cnblogs.com/hongjiumu/p/2660704.html
Copyright © 2011-2022 走看看