var iframes = parent.document.getElementsByTagName('iframe'); for (var i = 0; i < iframes.length; i++) { if (iframes[i].contentWindow == window) alert(iframes[i].id); }