有关_self和opener的问题

cj217 2003-07-18 01:31:51
在下面的程序中,
function result(s)
{
s = String(s);
this.content = s;
this.win = window.open("result.htm","_self");
this.see = function() {
win.document.all.title.innerHTML = this.title;
}
}

打开了一个窗口,result.htm,用了_self标签,以保证在原窗口上打开,而不是弹出一个新窗口。

接下来,在result.htm中
<body onLoad="opener.see();">

这一句,会提示opener为空或不是对象。

我的判断是opener所指的母窗口不存在了,原因是_self的影响。如果没有用_self,则程序不会出错。

请教如何改正这个错误?谢谢!!!!
...全文
134 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
cj217 2003-07-18
  • 打赏
  • 举报
回复
我已经在DEV-CLUB上等你好久了,是这样的,我正把你的NETBOOK研究。

我只是想open不要打开一个新窗口。

在最早的一个版本里有这样的一段程序:
function popwin(key) {
var conn = connect();
var rs = conn.Execute("select * from data where id="+key);
this.title = formString(rs("title"));
this.content = formString(rs("content"));
conn.Close();
this.win= open("view.htm","","height=450,width=600,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
/**
* 函数: see
* 功能: 回调函数,由弹出式窗口的onLoad调用
* 在弹出式窗口中显示内容
*/
this.see = function() {
win.document.title = "精华文章";
win.document.all.title.innerHTML = this.title;
win.document.all.content.innerHTML = this.content;
}
}

我提问的程序就是这个部分。
xuzuning 2003-07-18
  • 打赏
  • 举报
回复
覆盖了自然就没有了,这你也知道。不知你想干什么
win.document.all.title.innerHTML = this.title;
的意义是什么?

87,988

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧