如何更新父窗体

Response.Write("

1<script language="javascript">window.opener.location=window.opener.location.href;</script>

")

好了,给你个例子吧,自己改一下就可以了!!
第一种方案是:
file a.htm

function OpenDialog(url,param)
{
return window.open(url,param, "DialogWidth:450px;DialogHeight:450px;help:no;status:no");
}

file b.htm

1<script language="javascript">   
2function js_do(val)   
3{   
4self.opener.document.all.filename.value=val   
5}   
6</script>

第二种方案是:
file A.htm

 1<html>
 2<script language="javascript">   
 3function OpenDialog(url,param)   
 4{   
 5return window.showModalDialog(url,param, "DialogWidth:450px;DialogHeight:450px;help:no;status:no");   
 6} 
 7
 8function js_getData(url)   
 9{   
10return OpenDialog("b.htm","");   
11} 
12
13</script>
14<body>
15<form name="myFrm">
16<input name="filename" onclick="this.value=js_getData()" type="text"/>
17</form>
18</body>
19</html>

file b.htm

 1<html>
 2<script language="javascript">   
 3function js_do(val)   
 4{   
 5window.returnValue=val;   
 6window.close();   
 7}   
 8</script>
 9<body>
10<form name="myFrm">
11<input name="filename" type="text"/>
12<input name="btnDo" onclick="js_do(this.form.filename.value)" type="text"/>
13</form>
14</body>
15</html>

Response.Write("

1<script language="javascript">window.opener.document.all.txt1.value="+theValue+";</script>

");

Published At
Categories with Web编程
Tagged with
comments powered by Disqus