如何更新父窗体
2024-07-21 02:16:20
供稿:网友
response.write("<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
<script language="javascript">
function js_do(val)
{
self.opener.document.all.filename.value=val
}
</script>
第二种方案是:
file a.htm
<html>
<script language="javascript">
function opendialog(url,param)
{
return window.showmodaldialog(url,param, "dialogwidth:450px;dialogheight:450px;help:no;status:no");
}
function js_getdata(url)
{
return opendialog("b.htm","");
}
</script>
<body>
<form name="myfrm">
<input type="text" name="filename" onclick="this.value=js_getdata()">
</form>
</body>
</html>
file b.htm
<html>
<script language="javascript">
function js_do(val)
{
window.returnvalue=val;
window.close();
}
</script>
<body>
<form name="myfrm">
<input type="text" name="filename">
<input type="text" name="btndo" onclick="js_do(this.form.filename.value)">
</form>
</body>
</html>
response.write("<script language='javascript'>window.opener.document.all.txt1.value="+thevalue+";</script>");