C# 页面关联类似模式窗口

在做一项功能时,页面需要选择“社区”,

首先需要选择区域,选完区域后,再选择社区,页面会刷新,而且这个社区选择Div区域一开始不可见的,如果在一个页面操作不便,所以需要开启另外一个窗口。

所以用了window.open();

       function openSelectCommunity() {

            var url = "http://www.cnblogs.com/Index/Share/UserContronel/ChoiceCommunity.aspx"; 
            var option = "dialogHeight: 600px; dialogWidth: 650px; dialogTop: 458px; dialogLeft: 166px;";

            window.open(url, 'newwindow', 'height=600, width=500, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no');
        }

最后打开的页面用下面方法返回值:(想了很久才用了这个方法,其实想用模式窗口的,可是样式不好控制,所以放弃了)

function Browse_Page_CCommunity(AR_ID, COName) {

        //window.location.href = window.location.href.split('?')[0] + "?doType=CCommunity&AutoID=" + AR_ID + "&COName=" + encodeURIComponent(COName);
        
        //window.returnValue = COName;
        //页面刷新后,Chrome浏览器不能得到回传值,所以用此句进行兼容

        //self.parent.document.getElementById('txtHouseIDS').value = COName;
        //window.parent.reload();//貌似不可以
        //window.opener.location.reload();//父页重刷
        //window.opener.location.href="#";//父页重新连接


 window.opener.document.getElementById('ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_txtH_CommunityID').value = COName; 
window.opener.document.getElementById(
'ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_hidH_CommunityID').value = AR_ID;
window.opener
= null;
window.close(); }
原文地址:https://www.cnblogs.com/PLifeCopyDown/p/2888197.html