windows XP下自动关闭窗口的问题?

shgciom 2002-10-24 02:59:23
我在页面中用以下代码实现的自动关闭窗口:
<OBJECT id=close type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" VIEWASTEXT>
<param name="Command" value="Close">
</object>
<input type="button" value="关闭窗口" name="my" onclick="close.Click();" style="display:none">
<script>
if(document.body.clientWidth!=window.screen.width-10 && document.body.clientHeight!=screen.height-28){
var sWidth=screen.width/4;
var sHeight=screen.height-28;
l0=window.location.protocol;
l1=window.location.hostname;
str=window.location.href;
url=str.substring(l0.length+l1.length+3,str.length);
atleft=sWidth*3-10;
window.open(url,"","scrollbars=yes,fullscreen=no,toolbar=no,status=no,menubar=no,resizable=yes,width=" + sWidth + ",height=" + sHeight + ",left="+atleft+",top=0");
window.focus();

setTimeout("my.onclick();",0);
}
</script>
可是在windowsXP下就出现问题,提示my.onclick()只能在HTML下运行,不知道怎么办才好?
...全文
54 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
希默软件 2002-10-24
  • 打赏
  • 举报
回复
这个控件不知道还可以不可以?

<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
<input onClick=document.all.WebBrowser.ExecWB(45,1) type=button value=关闭窗口>
denghan 2002-10-24
  • 打赏
  • 举报
回复
上面梅花雨兄的方面不能用在IE5.5以下的版本,会出现“无法执行该命令”的错误提示,有哪位仁兄知道解决的办法?
meizz 2002-10-24
  • 打赏
  • 举报
回复
这个控件已经在新版的IE里被禁用了,你用别的方法吧!
window.opener=null;window.close() //IE5.5以上就不会有弹出提示了
qiushuiwuhen 2002-10-24
  • 打赏
  • 举报
回复
IE6 +sp1禁止了,改成

window.opener=null;
window.close();

87,996

社区成员

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

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