tags:

views:

130

answers:

4

How to de we calculate the number of iframes in a page? Please provide some pointers. Thanks in advance.

+1  A: 
document.getElementsByTagName("iframe").length
Marius
Thanks Marius for the quick help.
archana roy
A: 
var iframes = document.getElementsByTagName('iframe');
alert(iframes);

Note: This will not grab inner/nested iframes.

meder
Thanks Meder for the quick help.
archana roy
A: 

document.frames.length will also work. Unfortunately, this property is only available within Internet Explorer.

David Andres
Thanks david for the quick reply.
archana roy
@archana joy: No problem, just please be careful with respect to cross browser issues as reported in this answer.
David Andres
A: 

Thanks all.I got the answer.

document.frames.length OR document.getElementsByTagName("iframe").length

archana roy