monkotronic Posted July 9, 2007 Share Posted July 9, 2007 ok i opened a child window as such: theCart = window.open("whatever.html","theCart",cartFeatures); now i want to assign a div (id= "theDiv") some innerhtml: theCart.document.getElementById('theDiv').innerHTML = theTable; where theTable is some html code. it doesn't work. i get a "element has no properties" error. any ideas? websites? tutorials? code? for me??? the question in a general sense is: How do i reference the properties of an element in a child window? explicit code would be helpful since i have tried many variations already. thanks. Quote Link to comment Share on other sites More sharing options...
nogray Posted July 9, 2007 Share Posted July 9, 2007 You gotta wait until the second page loads before you access it's elements. You can use the script inside the whatever.html page to get the code from the parent window once it loaded. in whatever.html <script language="javascript"> function ini_page(){ document.getElementById('theDiv').innerHTML = opener.getConent(); } </script> <body onload="ini_page();"> in the main page function getContent(){ return theTable; } Just make sure theTable is a global variable. Code untested. Quote Link to comment Share on other sites More sharing options...
monkotronic Posted July 10, 2007 Author Share Posted July 10, 2007 ;)it worked like a charm, thanks! 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.