可以的!这样: <HTML> <HEAD> <script> function luru(){ var ss="liz.htm" var ww=12 window.showModalDialog(ss,ww) }</script></HEAD> <BODY> <form> <input type=button onclick="luru()" value="测试"><br> </form> </BODY> </HTML>lizi.htm <html> <body> <form name="form2" > <input type="text" name="textfield" size=20> </form> <script> var str=window.dialogArguments document.form2.textfield.value=str </script> </body> </html>
window.showModalDialog(sURL [, vArguments] [, sFeatures])Optional. Variant that specifies the arguments to use when displaying the document. Use this parameter to pass a value of any type, including an array of values. The dialog box can extract the values passed by the caller from the dialogArguments property of the window object.
用法: window.showModalDialog(sURL [, vArguments] [, sFeatures])vArguments Optional. Variant that specifies the arguments to use when displaying the document. Use this parameter to pass a value of any type, including an array of values. The dialog box can extract the values passed by the caller from the dialogArguments property of the window object.
在模态窗口中一般会有一个确定按钮,设定该按钮的onclick事件为return_value() <SCRIPT LANGUAGE="JavaScript"> <!-- function return_value() { window.returnValue = “你要传回的值”; window.close(); } //--> </SCRIPT>调用窗口打开模态窗口时: <SCRIPT LANGUAGE="JavaScript"> <!-- var res = showModalDialog("模态窗口.htm", "你要传给模态窗口的值", "dialogWidth:模态窗口宽度(单位:em); dialogHeight:高度; status:0"); //res就是模态窗口返回的值。 //--> </script>
<HTML>
<HEAD>
<script>
function luru(){
var ss="liz.htm"
var ww=12
window.showModalDialog(ss,ww)
}</script></HEAD>
<BODY>
<form>
<input type=button onclick="luru()" value="测试"><br>
</form>
</BODY>
</HTML>lizi.htm
<html>
<body>
<form name="form2" >
<input type="text" name="textfield" size=20>
</form>
<script>
var str=window.dialogArguments
document.form2.textfield.value=str
</script>
</body>
</html>
window.showModalDialog(sURL [, vArguments] [, sFeatures])vArguments Optional.
Variant that specifies the arguments to use when displaying the document. Use this parameter to pass a value of any type, including an array of values. The dialog box can extract the values passed by the caller from the dialogArguments property of the window object.
<SCRIPT LANGUAGE="JavaScript">
<!--
function return_value()
{
window.returnValue = “你要传回的值”;
window.close();
}
//-->
</SCRIPT>调用窗口打开模态窗口时:
<SCRIPT LANGUAGE="JavaScript">
<!--
var res = showModalDialog("模态窗口.htm", "你要传给模态窗口的值", "dialogWidth:模态窗口宽度(单位:em); dialogHeight:高度; status:0");
//res就是模态窗口返回的值。
//-->
</script>