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:

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.