zoukankan      html  css  js  c++  java
  • 简单js弹出窗口

    1.父窗口:

    ///弹出窗口
    function openwin() {
        var hdc = window.open("SelectCustomer.aspx", "popWindow", "width=300,height=500");
        hdc.moveTo((screen.width - 300) / 2, (screen.height - 500) / 2);
    }

    XHTML:

    <asp:TextBox ID="txtCustomerName" runat="server" Width="167px" ReadOnly="true"></asp:TextBox>
    <input type="button" value=" 选 择 " onclick="openWin()" />
    

    或者:

    <asp:TextBox ID="txtCustomerName" runat="server" Width="167px" ReadOnly="true"></asp:TextBox>
    <input type="button" value=" 选 择 " onclick="leftVal = (screen.width - 300) / 2;topVal = (screen.height - 500) / 2;window.open( 'SelectCustomer.aspx','popWindow','width=300,height=500,toolbars=yes,resizable=yes,scrollbars=yes,left='+leftVal+',top='+topVal);return false" />
    

    2.子窗口:

    function InsertName(name)
    {
        if (window.opener.document.getElementById("txtCustomerName").value == ''){
            window.opener.document.getElementById("txtCustomerName").value = name;
            window.close();
        }
        else {
            window.opener.document.getElementById("txtCustomerName").value = '';
            window.opener.document.getElementById("txtCustomerName").value = name;
            window.close();
        }
    }
    

    XHTML:

    <a onclick="javscript:InsertName('JevinXu');" href="javascript:void(0);" title="">JevinXu</a>
    

      

  • 相关阅读:
    Linux显示2015年日历表
    Linux显示系统日期
    Dialogs 对话框
    grid 属性
    VS2010 fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏 嵌入清单
    Perl Tk grid 布局
    Perl Tk pack布局示例
    Perl Tk grid布局管理器
    Perl DBI模块
    输入文本框模型
  • 原文地址:https://www.cnblogs.com/cancer_xu/p/2186193.html
Copyright © 2011-2022 走看看