• 点击textbox弹出对话框,返回弹出对话框的值


    主要是在父页面使用 function PopupWindow() {
                window.open(url, "", "status=no,resizable=no,toolbar=no,menubar=no,location=no,scroll=no,Width=600,Height=500");
            }

    打开页面

    然后在子页面调用opener.document获得父页面的document,然后将子页面某个控件的值赋给父页面控件

    父页面

    <script type="text/javascript">
          function PopupWindow() {
                window.open("SearchUserWindowModel.aspx", "", "status=no,resizable=no,toolbar=no,menubar=no,location=no,scroll=no,Width=600,Height=500");
            }
    </script>

     <asp:TextBox ID="txtParentTextbox" runat="server"></asp:TextBox>
     <input type="button" value="Popup window" onclick="PopupWindow()" />

    子页面

    <script type="text/javascript">
            function ReturnValue() {
                if (opener != 'undefined' && opener != null) {
                    //opener.document.getElementById("txtParentTextbox").value = document.getElementById("ddlCity").options[document.getElementById("ddlCity").selectedIndex].value;
                    opener.document.getElementById("txtParentTextbox").value = document.getElementById("ddlCity").options[document.getElementById("ddlCity").selectedIndex].text;
                    window.close();
                }
            }
    </script>

         <asp:DropDownList runat="server" ID="ddlCity"></asp:DropDownList>
            <asp:Button runat="server" ID="btnSeach" OnClick="btnSeach_Click" Text="查询" />
            <input type="button" value="Ok" onclick="ReturnValue();" />

  • 相关阅读:
    python 安装与pip安装
    使用通配符来解决数据1和11、12/13/14的问题
    数据库中一行变多行,拆分数据
    15-哈希表 HashTable
    13-自平衡二分搜索树 AVLTree
    12-并查集 UnionFind
    11-字典树 Trie
    10-线段树 Segment Tree
    09-堆 Heap(最大堆)
    08-映射 Map
  • 原文地址:https://www.cnblogs.com/Mac_Hui/p/3263642.html
Copyright © 2020-2023  润新知