日期:2014-05-16  浏览次数:20391 次

父窗口(可能会刷新)如何查找子窗口
rt,thx

------解决方案--------------------
刷新了信息就丢失了~~找不到了~~
------解决方案--------------------
可以把信息存在cookie里面。。。
------解决方案--------------------
如楼上,或者父页面用免刷新的。
------解决方案--------------------
是不是这样?
a.html
=========================
<!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= " ">
<script language= "javascript ">
function newwindow()
{
window.open( "b.html ", "child ");
}

function freshcurrentwin()
{
document.write( " <html> ");
document.write( " <head> ");
document.write( " <script> ");
document.write( "function get(){var a=window.open( 'javascript:void() ', 'child ');alert(a.document.getElementById( 'a ').value);} ");
document.write( " </sc "+ "ript> ");
document.write( " </head> ");
document.write( " <body> ");

document.write( " <input type= 'button ' value= '刷新后得到子窗口引用 ' onclick= 'get() '> ");
document.write( " </body> ");

document.write( " </html> ");
}
</script>
</HEAD>

<BODY>
<input type= "button " onclick= "newwindow() " value= "open "/> <input type= "button " value= "fresh " onclick= "freshcurrentwin() "/>
</BODY>
</HTML>


b.html
==================
<!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>

<BODY>
<input type= "text " id= "a " value= "123456 "/>
</BODY>
</HTML>

不过出错了。。不知道为啥
------解决方案--------------------
@可以把信息存在cookie里面。。。

不可能~~~你以为是菜市场买菜啊~~~