a.html
view sourceprint?01 <html>
02 <head>
03 <title>主页面</title>
04 <script language="javascript" type="text/javascript">
05 function OpenNew()
06 {
07 var im=new IDAndMethod();
08 im.ID=document.getElementById("txtID").value;
09 window.showModalDialog("ddd.html",im,"");
10 }
11 function IDAndMethod()
12 {
13 this.ID="ddd";
14 this.Method=SetTxt;
15 }
16 function SetTxt(str)
17 {
18 document.getElementById("txtID").value=str;
19 }
20 </script>
21 </head>
22 <body>
23 <form action="#">
24 <input id="txtID" style="width:400px" type="text" value="XXX!在这里输入ID!" /><br />
25 <input type="button" value="打开新的窗口" οnclick="OpenNew()" />
26 </form>
27 </body>
28 </html>
b.html
view sourceprint?01 <html>
02 <head>
03 <title>主页面</title>
04 <script language="javascript" type="text/javascript">
05 var im;
06 function Load()
07 {
08 im=window.dialogArguments;
09 if(im.ID=="XXX!在这里输入ID")
10 document.getElementById("txtID1").value="你杂不输入呢!";
11 else
12 document.getElementById("txtID1").value=im.ID;
13 }
14 function Set()
15 {
16 im.Method(document.getElementById("txtID1").value);
17 }
18 </script>
19 </head>
20 <body οnlοad="Load()">
21 <form action="#">
22 <input id="txtID1" style="width:400px" type="text" value="ddd" /><br />
23 <input type="button" value="传递数据" οnclick="Set()" />
24 </form>
25 </body>
26 </html>
view sourceprint?01 <html>
02 <head>
03 <title>主页面</title>
04 <script language="javascript" type="text/javascript">
05 function OpenNew()
06 {
07 var im=new IDAndMethod();
08 im.ID=document.getElementById("txtID").value;
09 window.showModalDialog("ddd.html",im,"");
10 }
11 function IDAndMethod()
12 {
13 this.ID="ddd";
14 this.Method=SetTxt;
15 }
16 function SetTxt(str)
17 {
18 document.getElementById("txtID").value=str;
19 }
20 </script>
21 </head>
22 <body>
23 <form action="#">
24 <input id="txtID" style="width:400px" type="text" value="XXX!在这里输入ID!" /><br />
25 <input type="button" value="打开新的窗口" οnclick="OpenNew()" />
26 </form>
27 </body>
28 </html>
b.html
view sourceprint?01 <html>
02 <head>
03 <title>主页面</title>
04 <script language="javascript" type="text/javascript">
05 var im;
06 function Load()
07 {
08 im=window.dialogArguments;
09 if(im.ID=="XXX!在这里输入ID")
10 document.getElementById("txtID1").value="你杂不输入呢!";
11 else
12 document.getElementById("txtID1").value=im.ID;
13 }
14 function Set()
15 {
16 im.Method(document.getElementById("txtID1").value);
17 }
18 </script>
19 </head>
20 <body οnlοad="Load()">
21 <form action="#">
22 <input id="txtID1" style="width:400px" type="text" value="ddd" /><br />
23 <input type="button" value="传递数据" οnclick="Set()" />
24 </form>
25 </body>
26 </html>