Jump to content

access to another html document with javascript


aldm

Recommended Posts

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 :shy:

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?

Yes you can, alleast in theory  :P. 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  :D.

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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.