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

    js 子窗口赋值到父窗口

     

    父窗口:

    <script>
    function openWin(str) {
        window.open(siteurl
    +"popup/"+str, null,'width=800,height=500'); // 打开窗口

    </script> 
    <input type="text" id="title" name="picPath" value="<?php if(isset($pic)) {echo $pic['Path'];}?>" /> 
    <href="javascript:;" onclick="openWin('searchPic');">图片</a>

    子窗口:

    <html>
        
    <head>
            
    <title>图片搜索</title>
        
    </head>
        
    <body>
            
    <script>
                
    function getValue() {
                    window.opener.document.getElementById(
    'title').value = document.getElementById('picPath').value // 赋值
                    window.close(); // 关闭窗口
                }
            
    </script>
            
    <input type="text" id="picPath" />
            
    <input type="button" value="确定" onclick="getValue()" />
        
    </body>

    </html> 

  • 相关阅读:
    1022 D进制的A+B
    1021 个位数统计
    L1-040 最佳情侣身高差
    Celery--基本使用
    Celery--安装
    Celery--简介
    RabbitMQ--常用命令
    RabbitMQ--RPC实现
    RabbitMQ发布订阅
    RabbitMQ基本使用
  • 原文地址:https://www.cnblogs.com/tyler-bog/p/11059653.html
Copyright © 2011-2022 走看看