如何使window.open失效

go786 2009-09-25 04:29:42
我用a.htm框架b.htm,b.htm中放了window.open弹出窗口代码,打开a.htm就会弹出。
我在网上搜索发现使用下面这个代码可以使window.open失效。但是前提是需要放在b.htm页面上。
<script>
function window.open()
{
return false;
}
</script>
我想实现只修改a.htm代码的情况下,用a.htm页面 iframe b.htm的时候让他的window.open失效。
说的有点罗嗦,各位听懂了吗?http://bbs.51js.com/thread-16902-1-1.html 这个帖子中有个方法,但是我使用没有效果。
...全文
89 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
go786 2009-09-25
  • 打赏
  • 举报
回复
楼上果然高手 这么细心的问题都能想到 iframe放在后面应该没有数到他 我怎么没想到 太感谢了
guodong66 2009-09-25
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 bing475879749 的回复:]
1.html
HTML code<iframesrc="2.html"></iframe><script>
document.frames[0].window.open=function() {returnfalse};</script>

2.html
HTML code<script>
window.open("http://www.google.cn")</script>
[/Quote]

正解,跨frame传值也是这种方法
bing475879749 2009-09-25
  • 打赏
  • 举报
回复
1.html
<iframe src="2.html"></iframe>
<script>
document.frames[0].window.open = function() {return false};
</script>


2.html
<script>
window.open("http://www.google.cn")
</script>

87,907

社区成员

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

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