关于js的模态对话框问题 程序是写的一个模态对话框(以实现),现在遇到的问题是,有个进程会每隔一段时间往我的页面传递一个参数,传过来的同时,刷新此页面,但是在打开了模态对话框的情况下,就不会有任何反应。请问各位大虾有没有什么解决的办法? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 修改你的模态对话框的实现(不要使用Window.ShowModalDialog),使其不要阻塞js的执行可以使用一些Jquary等的插件来实现模态对话框 使用非模态的modeless窗口,可以解决,新的问题又来了,window.returnValue好像只能获取模态的,非模态的又通过什么返回值? 你是用window.open的吧?可以在子窗口调用父窗口函数:父窗口:<script>function a(){ window.open("tt.php");}function b(k){ alert(k);}</script>子窗口:<script>window.opener.b("ss");window.close();</script> --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(); } } 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;" ); 如果再要子窗口返回值给父窗口的话就没法调用window的对象了,郁闷ing ok,已彻底解决,modeless传对象的话要在父窗口写专门的处理函数感谢zcy_dr的指教,帮助很大 javascript调用applet问题,急 请教如何实现类似126邮箱的web多文档窗口? 字符串和十六进制数之间的转换 让网页变黑白 能否实现直接打印 我建立了一个群,主要用于探讨HTML,DHTML,CSS,JAVASCRIPT,FLASH,DREAMWEAVER,PHOTOSHOP技术,希望从事这方面工作的同志加入 如何直接关闭Win2000自带的IE的窗口?即IE5.01 关于下载确认框 怎么在打开一个窗口前关半当前窗口. 在window.open打开一个新窗口时,如何在新窗口中取得打开前窗口的input框的值 关于js的模态对话框问题 这个怎么创建不了 table 呀??
可以使用一些Jquary等的插件来实现模态对话框
可以在子窗口调用父窗口函数:
父窗口:
<script>function a(){
window.open("tt.php");
}
function b(k){
alert(k);
}</script>
子窗口:
<script>
window.opener.b("ss");
window.close();
</script>
--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();
}
}
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;" );
感谢zcy_dr的指教,帮助很大