parent window iframe element trigger click by simple JavaScript -
In the iframe element of the parent window it is necessary to trigger the occurrence of simple javascript clicking.
Original Window hair window But onload child window gets this JavaScript error: and file html_test.php is html: If your opener window is ifream page, just do this code .
& lt; Html & gt; & Lt; Top & gt; & Lt; Meta http-equiv = "content-language" content = "n" /> & Lt; Title & gt; Main window & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Iframe scrolling = "auto" src = "html_test.php" & gt; & Lt; / Iframe & gt; & Lt; Button onclick = 'window.open ("child.html") & gt; Open window & lt; / Button & gt; & Lt; / Body & gt; & Lt; / Html & gt;
& lt; Script type = "text / javascript" & gt; . Click on window.opener.document.getElementsByTagName ('iframe') [0] .document.getElementById ('main_tab') (); & Lt; / Script & gt;
type error: window.opener.document.getElementsByTagName ('iframe') [0] .document is undefined
html_test.php div element
main_tab is there already.
& lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; Exam iframe & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Ul & gt; & Lt; Li id = "main_tab" onclick = "alert ('test click')" & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Body & gt; & Lt; / Html & gt;
click on window.opener.document.getElementById ('main_tab') ();
Comments
Post a Comment