zoukankan      html  css  js  c++  java
  • 点击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();" />

  • 相关阅读:
    C#仿QQ皮肤系列之-引言
    教你打造Silverlight超酷翻页实例
    大文件上传 进度条显示 (仿csdn资源上传效果)
    Winform下的地图开发控件(GMap.NET)使用心得之二
    Web打印的解决方案之普通报表打印
    基于jQuery的表单验证插件:jValidate
    判断时间段内有几个休息期
    C++基础语法
    Web网页安全色谱
    C#仿QQ皮肤-总体层次说明(二)
  • 原文地址:https://www.cnblogs.com/Mac_Hui/p/3263642.html
Copyright © 2011-2022 走看看