日期:2014-05-16  浏览次数:20515 次

showModalDialog的问题,明白的进来看一下
画面的一个button提交的时候,弹出一个模态的窗口,把新的数据显示在这个窗口上,调用showModalDialog如何实现啊,需要去server端去取一次数据的

------解决方案--------------------
onclick= "window.showModalDialog( 'xxx.asp?param=xxx ') "

xxx.asp执行的时候就是在服务器端操作完毕后显示的
------解决方案--------------------
/**
* This function is to submit a form to ModalDialog.
* JK 2007-03-06
*/
function submitToModalDialog(formObj,dialogTitle,sFeatures){
var dialogArguments=new Array();
dialogArguments[ "src "]=null;
dialogArguments[ "title "]=dialogTitle;
dialogArguments[ "form "]=formObj;
return showModalDialog( "jsp/DialogFrame.jsp ",dialogArguments,sFeatures);
}

其中,DialogFrame.jsp的内容大致如下:
<%@ page contentType= "text/html;charset=UTF-8 " %>

<html>

<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=UTF-8 ">
<script language=javascript>

var DialogArgument=window.dialogArguments;
if (DialogArgument!=null) document.write( " <title> "+DialogArgument.title+ " </title> ");
else document.write( " <title> Dialog </title> ");
</script>
<title> Dialog </title>
</head>

<body leftMargin=0 rightMargin=0 topMargin=0 bottomMargin=0 onload= "initFun(); " scroll=no>
<iframe name= "dialogFrame " src= "/blank.html " width=100% height=100% id=dialogIframe> </iframe>
<form name= "dialogForm " method= "post " action= " " target= "dialogFrame " style= "display:none; ">
<input type= "hidden " name= "tempXXXX ">
</form>
</body>

</html>
<script language=javascript>

function initFun()
{

if (DialogArgument!=null){
if(DialogArgument.form!=null){
var argForm=DialogArgument.form;
var dialogForm=document.dialogForm;
dialogForm.action=argForm.action;
var argFormElements=argForm.elements;
for(var i=0;i <argFormElements.length;i++){
dialogForm.insertAdjacentHTML( "beforeEnd ",argFormElements[i].outerHTML);
}
dialogForm.submit();
}
else{
document.dialogForm.action=DialogArgument.src;
document.dialogForm.submit();
}

}
else alert( "Use DialogFrame wrongly. ");
}

</script>
------解决方案--------------------
showModalDialog打开的页面就可以执行后台操作,和其他页面一样。取数据的过程就可以在showModalDialog的页面里做,可以用问号从父画面传参数给这个页面取数用。
window.showModalDialog( "******.***?param1=**&param2=**, " ", "dialogHeight:600px;dialogWidth:800px;menubar:no;help:no;status:no;scroll:no;directories:no ");