javascript - Getting the img tag inside iframe -


I have an IFrame with a class name = "blacklash". In it, I have no name (or ID) and this div is a div with square name = "square" inside. Inside this divide, lie with two images (no class name / id).

How can I get those images? If there is a prototype version even better!

PS: Before adding the page completely, I can not add class name / id (I am not creating IFrame - it is dynamically created through javascript and after this my script Run)

Thx

a.html:

  & Lt ;! DOCTYPE HTML Public "- //W3C / DTD XHTML 1.0 Transcription // N" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> & Lt; Html xmlns = "http://www.w3.org/1999/xhtml" xml: lang = "en" lang = "en" & gt; & Lt; Body onLoad = "foo ()" & gt; & Lt; Iframe src = "b.html" & gt; & Lt; / Iframe & gt; & Lt; Script type = "text / javascript" & gt; Function foo () {warning (window.frame [0] .document.getElementsByClassName ("class") [0] .getElementsByTagName ("img") [0] .src); } & Lt; / Script & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

b.html:

  & lt ;! DOCTYPE html public "- // W3C // DTD XHTML 1.0 Transcription // N http: //www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> & Lt; Html xmlns = "http://www.w3.org/1999/xhtml" xml: lang = "en" lang = "en" & gt; & Lt; Body & gt; & Lt; Div & gt; & Lt; Div class = "square" & gt; & Lt; Img id = "img" src = "test.png" /> & Lt; Img id = "img" src = "test.png" /> & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

Comments