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 Link to comment https://forums.phpfreaks.com/topic/173035-access-to-another-html-document-with-javascript/ 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? Link to comment https://forums.phpfreaks.com/topic/173035-access-to-another-html-document-with-javascript/#findComment-912041 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? Link to comment https://forums.phpfreaks.com/topic/173035-access-to-another-html-document-with-javascript/#findComment-913113 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 . Link to comment https://forums.phpfreaks.com/topic/173035-access-to-another-html-document-with-javascript/#findComment-913191 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> Link to comment https://forums.phpfreaks.com/topic/173035-access-to-another-html-document-with-javascript/#findComment-914683 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.