window.showModalDialog的使用方法

测试代码:
1、父页面代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
 </HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
	function test(){
		var args = new Object();
		args.name="asddddddddddddddf";
		args.version="0.1";
		var test = window.showModalDialog("2.html",args, "dialogWidth=200px;dialogHeight=200px");
		alert(test.version);alert(test.name);
	}
//-->
</SCRIPT>
 <BODY>
  <input type='button' value="test" onclick="test()"/>
 </BODY>
</HTML>

2、弹出窗口页面代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
 </HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
	alert(window.dialogArguments.name);
	var obj = new Object();
	obj.version="1.0";
	obj.name="liuxiyong333";
	window.returnValue=obj;
//-->
</SCRIPT>
 <BODY>
    <input type='button' value="test" onclick="javascript:window.close();"/>
 </BODY>
</HTML>

你可能感兴趣的:(java,html)