aldm Posted September 3, 2009 Share Posted September 3, 2009 Hi, Is there any way (an how) to access from one html document to another html document with javascript (or php)? For example, I have html document named dodaj_novost.html and another document named video_index.html. If I want to change the innerHTML of element in video_index.html from dodaj_novost.html? Thanks in advance Quote Link to comment Share on other sites More sharing options...
rhodesa Posted September 3, 2009 Share Posted September 3, 2009 can you elaborate? are you thinking like you have one page (we'll call it the parent), and from that page you open a popup (we'll call it the child) and you want the parent/child to be able to communicate together with javascript? Quote Link to comment Share on other sites More sharing options...
aldm Posted September 5, 2009 Author Share Posted September 5, 2009 yes...for example, I want to change innerHTML of some element in child page, with code from parent page...how can I do that? Quote Link to comment Share on other sites More sharing options...
mrwutang Posted September 5, 2009 Share Posted September 5, 2009 Yes you can, alleast in theory . But both the documents will have to be on your server, and with javascript you cannot change the document permanently. If none of these are a prolem to you then sure, you can do this. Make a script to open your child document in a window or frame. Then use the refernce from parent window to control the element . Quote Link to comment Share on other sites More sharing options...
rhodesa Posted September 8, 2009 Share Posted September 8, 2009 to elaborate...the parent would look like: <input type="button" value="Open Child" onclick="child_win = window.open('child.html');"> <input type="button" value="Alter Child" onclick="child_win.document.getElementById('child_ele').innerHTML = 'Here is the new text';"> and the child like this: <p id="child_ele">Here is some text before</p> 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.