简体   繁体   English

使用 javascript 或 jquery 关闭 iframe

[英]Close iframe using javascript or jquery

I have a series of iframes in my html page.我的 html 页面中有一系列 iframe。 Upon a button click, I would like to close the last iframe in the list.单击按钮后,我想关闭列表中的最后一个 iframe。 How do I do that?我怎么做?

Effectively, I want to do a window.close() on the last iframe and not a.remove().实际上,我想在最后一个 iframe 上执行 window.close() 而不是 a.remove()。

What do you mean "close" an iframe?您是什么意思“关闭” iframe? Like Sascha said, it's not something that can be closed.就像萨沙说的,这不是可以关闭的东西。 Do you just want to do something like change the source to "about:blank" to make it appear empty?您是否只想将源更改为“about:blank”以使其显示为空?

I have now made an example of this ( http://jsfiddle.net/fZDk3/ ) that uses $("#ifrm").attr("src", "about:blank");我现在做了一个使用 $("# ifrm $("#ifrm").attr("src", "about:blank");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM