When you have a loop through all iframes in a page like this:
HTML:
<ul>
<li id="a"><iframe src="..." /></li>
<li id="b"><iframe src="..." /></li>
<li id="c"><iframe src="..." /></li>
</ul>
JS:
for (var i = 0; i < window.frames.length; i++) {
if (window.frames[i].getName() == selector) {
frame_item = ????
break;
}
}
How can I get the DOM element for the < iframe>? Or following the example, how can I get the ID for the < li> item inside the loop?
UPDATED answer.
window.frames references directly to the IFRAME context (iframe’s window object). AFAIK you cannot obtain IFRAME object by this way. You can access IFRAME’s variables via window.frames[0].myVar.
To get all IFRAME node/objects use:
Alternatively you can assign id to UL element and