文章出處
文章列表
今天做東西用到,在網上查到了這樣的一種方法,學習學習:
來源:http://bbs.csdn.net/topics/310229114
Page1:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>無標題頁</title> <script type="text/javascript"> function OpenWin() { window.open("father.htm","aa","",""); } </script> </head> <body> <input id="T1" type="text" /> <input id="Button1" type="button" value="提交" onclick="OpenWin();" /> </body> </html>
Page2:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>無標題頁</title> <script type="text/javascript"> function ReturnVal() { window.opener.document.getElementById('T1').value=document.getElementById('Text1').value; window.close(); } </script> </head> <body> <input id="Text1" type="text" /> <input id="Button1" type="button" value="關閉" onclick="ReturnVal();" /> </body> </html>
PS:
使用window.opener可以訪問js的變量 :window.opener.變量名
-------------
文章列表
全站熱搜