How can I list all FRAMESET elements in an HTML document using JavaScript? I believe it to be possible to select these elements in the DOM tree because the DOM Inspector plugin for Firefox is able to list all the FRAMESETS in a page.
There's a window.frames collection, if that's what you mean.
EDIT:
Ah. For blowing away all frameset elements, getElementsByTagName:
var framesets = document.getElementsByTagName('frameset');
for (var i = 0; i < framesets.length; i++) {
// optional test for whether framesets[i]'s hatesFreedom attribute is true or false
framesets[i].parentNode.removeChild(framesets[i]);
}
Or jQuery, obviously:
$('frameset[hatesFreedom=true]').remove();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With