adam84 Posted September 23, 2010 Share Posted September 23, 2010 From my parent window I open up a child window. What I want to do is run something in the child window, then onces it competes. Update a div tag in the parent then close the child window. this is my JS in the child window function update_parent(){ window.opener.document.getElementById('resultDIV').innerHTML = 'Here I am'; } When I test this, I get an access denied JS error. Any ideas on what I should do or change? Thanks Quote Link to comment Share on other sites More sharing options...
Psycho Posted September 23, 2010 Share Posted September 23, 2010 Works fine for me. Must be a problem somewhere else in your code. Here is the code I tested with Parent <html> <body> <button onclick="window.open('child.htm')">Open Child</button> <div id="resultDIV">Doesn't work</div> </body> </html> Child <html> <head> <script type="text/javascript"> function update_parent() { window.opener.document.getElementById('resultDIV').innerHTML = 'works'; window.close(); } </script> </head> <body> <button onclick="update_parent()">Update Parent</button> </body> </html> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.