zoukankan      html  css  js  c++  java
  • javascript弹出子窗口并返回值

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head>
    <script type="text/javascript">
    function returnWin(){
    window.returnValue
    =document.Form2.TextBox1.value;
    window.close();
    }
    </script>


    <body>
    <form name="Form2" id="Form2">

    <input name="TextBox1" id="TextBox1" value="123" type="text" />
    <input name="button" value="返回" type="button" onclick="returnWin();" />
    </form>
    </body>
    </html>
    1.html
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head>
    <script> 
    function OpenWin(){
        
    var str=window.showModalDialog('2.html',document.Form1.TextBox1.value,'help:no');
        
    if(str!=null)  {
            document.Form1.TextBox1.value
    =str;
        }
    }
    </script>

    <body>
    <form name="Form1">
    <input name="TextBox1" id="TextBox1" value="1" />
    <input type="button" name="Button1" value="打开窗口" onclick="OpenWin();" id="Button1" style="96px;" />
    </form>
    </html>

    2.html

  • 相关阅读:
    luogu P3375 【模板】KMP字符串匹配
    leetcode[129]Sum Root to Leaf Numbers
    leetcode[130]Surrounded Regions
    leetcode[131]Palindrome Partitioning
    leetcode[132]Palindrome Partitioning II
    leetcode[133]Clone Graph
    leetcode[134]Gas Station
    leetcode[135]Candy
    leetcode[136]Single Number
    leetcode[137]Single Number II
  • 原文地址:https://www.cnblogs.com/didiao/p/1422103.html
Copyright © 2011-2022 走看看