程序是写的一个模态对话框(以实现),现在遇到的问题是,有个进程会每隔一段时间往我的页面传递一个参数,传过来的同时,刷新此页面,但是在打开了模态对话框的情况下,就不会有任何反应。请问各位大虾有没有什么解决的办法?

解决方案 »

  1.   

    修改你的模态对话框的实现(不要使用Window.ShowModalDialog),使其不要阻塞js的执行
    可以使用一些Jquary等的插件来实现模态对话框
      

  2.   

    使用非模态的modeless窗口,可以解决,新的问题又来了,window.returnValue好像只能获取模态的,非模态的又通过什么返回值?
      

  3.   

    你是用window.open的吧?
    可以在子窗口调用父窗口函数:
    父窗口:
    <script>function a(){
    window.open("tt.php");
    }
    function b(k){
    alert(k);
    }</script>
    子窗口:
    <script>
    window.opener.b("ss");
    window.close();
    </script>
      

  4.   


    --A页面
    <script language="javascript" type="text/javascript">
            function back() {
                self.close();
            }
            function selectDept(type, input) {
                var valueInput = "";
                var id = document.getElementById("<%=hfId.ClientID %>").value;
                if (type == "b")
                    valueInput = document.getElementById("<%=hfBelongDept.ClientID %>");
                else
                    valueInput = document.getElementById("<%=hfRelateDept.ClientID %>");
                var url = "../Dept/DeptChkTree.aspx?type=" + type + "&rand=" + parseInt(Math.random() * 1000) + "&text=" + input.id + "&value=" + valueInput.id + "&id=" + id;
                var ie = GetBrowserType();
                if (ie == 'IE8' || ie == 'IE7' || ie == 'IE6') {
                    try {
                        var result = ShowDialog(url, '600px', '500px', 'no');
                        var data = result.split('#');
                        input.value = data[0];
                        valueInput.value = data[1];
                    }
                    catch (error) { ; }
                }
                else {
                    //OpenWindow(url,'增加',300,500);
                    window.open(url);
                }
            } 
        </script>--B页面
    function returnSelectValue() {
                var textInput = document.getElementById("<%=hfValueInputId.ClientID %>").value;
                var valueInput = document.getElementById("<%=hfTextInputId.ClientID %>").value;
                var strText = "";
                var strValue = "";
                var lib = window.document.getElementById("<%=libDept.ClientID %>");
                var length = lib.options.length;
                for (var i = 0; i < length; i++) {
                    strText = strText + lib.options[i].innerText + ",";
                    strValue = strValue + lib.options[i].value + ",";
                }
                if (strText.length < 1) {
                    strText = ",";
                    strValue = ",";
                }
                var ie = GetBrowserType();
                if (ie == 'IE8' || ie == 'IE7' || ie == 'IE6') {
                    try {
                        window.returnValue = strText.substring(0, strText.length - 1) + "#" + strValue.substring(0, strValue.length - 1);
                        window.close();
                    }
                    catch (error) { ; }
                }
                else {
                    window.opener.document.getElementById(textInput).value=strText.substring(0, str.length - 1);
                    window.opener.document.getElementById(valueInput).value = strValue.substring(0, str.length - 1);
                    window.close();
                }            
            }
      

  5.   

    6楼的有看没有懂
    7楼,非模态的,modeless这个,我已经测试成功了window对象了,可是好像不能传回自己的参数
    具体代码如下
    var old_select = document.getElementById( 'select_type' ).value + ';'
    + document.getElementById( 'select_request_type' ).value + ';'
    + document.getElementById( 'select_class_id' ).value + ';'
    + document.getElementById( 'select_service_code' ).value + ';'
    + document.getElementById( 'select_activity_code' ).value + ';'
    + document.getElementById( 'select_question_code' ).value;

    winret = window.showModelessDialog( sURL, old_select, "dialogHeight: 540px; dialogWidth: 506px; edge: Raised; center: Yes; help: No; resizable: No; status: No;" );
      

  6.   

    如果再要子窗口返回值给父窗口的话就没法调用window的对象了,郁闷ing
      

  7.   

    ok,已彻底解决,modeless传对象的话要在父窗口写专门的处理函数
    感谢zcy_dr的指教,帮助很大