Access child window elements from parent window using Javascript

sycleWeep

New Member
I need to access child window elements from parent window. I have written the sample snippets below.Parent HTML:\[code\]<html><head><title>Parent</title><style>div{float:left;cursor:pointer;}</style><script type="text/javascript">var SubpopUpWin="";function Opennew(passedURL){ SubpopUpWin = window.open("popups.html", '_blank','toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes'); SubpopUpWin.document.getElementById("ifrm").src=http://stackoverflow.com/questions/9600969/passedURL; SubpopUpWin.document.getElementById("ifrm_title").innerHTML=passedURL; }</script></head><body><div onclick="Opennew('http://www.google.com')">Google</div> <div onclick="Opennew('http://www.yahoo.com')">Yahoo</div><div onclick="Opennew('http://www.bing.com')">Bing</div></body></html>\[/code\]popups.html\[code\]<html><head><title>Child</title><style>div{float:left;}</style></head><body><div> <div id="ifrm_title"></div> <div style="margin-top:20px"> <iframe id="ifrm" src="" width="470" height="270" frameborder="0" style="margin-top: 34px" scrolling="no"></iframe> </div></div></body></html>\[/code\]In the above code is not working. Even I have used the below script also.\[code\]<script type="text/javascript">var SubpopUpWin="";function Opennew(passedURL){ SubpopUpWin = window.open("popups.html", '_blank','toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes'); SubpopUpWin.onload=function(){ SubpopUpWin.document.getElementById("ifrm").src=http://stackoverflow.com/questions/9600969/passedURL; SubpopUpWin.document.getElementById("ifrm_title").innerHTML=passedURL; }}</script>\[/code\]The above code also not working. Please share your sugestions/solutions...Thanks
 
Back
Top