模式窗体 showModalDialog
功能: 在一个窗体A中需要打开另外一个窗体B,在B窗体中填写值,返回到A窗体中。
path参数可以是任何jsp html action 等。
父窗体parant.html
<script>function fortable1(){/****弹出模式对话框*****/path = "table.html";//向子窗体传参数:helloworld//当子窗体关闭时,把子窗体的返回值赋值给arr.var arr = window.showModalDialog(path,"helloworld","dialogHeight:500px;dialogWidth:450px;edge:Raised;center:Yes;z-look:no;help:No;resizable:no;status:yes;");if (arr!= null){var ss;ss=arr.split("*")document.all.a.value= ss[0];document.all.b.value= ss[1];}}</script></head><body><input type=text name=a><input type=text name=b><input type="button" name="S" value="选择" onClick="fortable1();"><body></body></html><head><META HTTP-EQUIV="Expires" CONTENT="0"><META HTTP-EQUIV="Pragma" CONTENT="no-cache"><META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate"></head>/*************************************************************/<SCRIPT LANGUAGE=JavaScript>function aaa(){alert(window.dialogArguments);//获取父窗体传过来的参数window.returnValue = selrow.value+"*"+selcol.value;//向父窗体传值window.close();}</SCRIPT></HEAD><BODY >输入表格<table border="0" cellspacing="10" cellpadding="0"> <tr><td><INPUT TYPE=TEXT SIZE=7 ID=selrow></td><td> <input type=text id=selcol size=7> </tr> <tr><td><BUTTON ID=Ok TYPE=button ONCLICK="aaa();">传值</BUTTON> </td> </tr></table></BODY> </HTML>