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>

  • 相关阅读:
    【转】双口RAM
    Beep使用
    fcntl函数
    ioctl() 参数
    线程属性:pthread_attr_t
    GPIO
    Linux CGI编程基础
    看门狗watchdog
    Linux库知识大全
    linux进程间通讯
  • 原文地址:https://www.cnblogs.com/hongjiumu/p/2660704.html
Copyright © 2011-2022 走看看