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

    父窗口

     1 <!DOCTYPE html>
     2 <html>
     3 <head lang="en">
     4     <meta charset="UTF-8">
     5     <title>window object</title>
     6 
     7     <script type="text/javascript">
     8 
     9 
    10     </script>
    11 
    12 </head>
    13 <body>
    14     <div onclick="window.open('bless.html','aa','width=400,height=500')">祝福语</div>
    15     <div id="m"></div>
    16 </body>
    17 </html>

    子窗口

     1 <!DOCTYPE html>
     2 <html>
     3 <head lang="en">
     4     <meta charset="UTF-8">
     5     <title></title>
     6 
     7     <script type="text/javascript">
     8         function mess(){
     9             //获取祝福语
    10             var message = document.getElementById("blessMes").value;
    11             //获取父类窗口
    12             var p = window.opener;
    13             //获取父类窗口中的id为bless的div
    14             var pd = p.document.getElementById("m");
    15             //设置pd的值
    16             pd.innerHTML = message;
    17             //关闭当前窗口
    18             window.close();
    19         }
    20 
    21 
    22     </script>
    23 
    24 </head>
    25 <body>
    26     <input id="blessMes"  type="text" >
    27     <input type="button" value="送上祝福" onclick="mess()">
    28 </body>
    29 </html>
  • 相关阅读:
    C和C++的不同点
    音频质量评价指标
    常用函数整理
    Subband Decomposition
    Stability Analysis of Algorithms
    Time Frequency (T-F) Masking Technique
    雅克比(Jacobi)方法
    寒假3
    寒假作业二
    寒假 2
  • 原文地址:https://www.cnblogs.com/a757956132/p/5242409.html
Copyright © 2011-2022 走看看