I'm trying to close a Iframe and the below works for every browser except for IE7 开发者_开发知识库an IE8. Any suggestions for IE? The button acutally exists on the iframe itself.
<input type="submit" onclick="history.go(0)"
I don't know what "close" means with regard to an iframe
other than removing it, so:
You can remove an iframe
from the document using removeChild
on its parent node, e.g.:
var iframe = window.parent.document.getElementById('theIframe');
iframe.parentNode.removeChild(iframe);
Live example
There I'm using an id
to find the iframe
element in the parent window, but obviously you have lots of choices for how to find it. Ultimately it comes down to calling removeChild
.
精彩评论