Jump to content

document.getElementById, but for another page?


Archdeacon

Recommended Posts

I have 2 pages where I need to access, via javascript, certain 'id's of each one. Can I use something like 'document("index.html").getElementById("link1)' or must I hard code the common links into a javascript function?

Link to comment
Share on other sites

var x = self.opener.parent.document.getElementById("link1").href;var y = self.opener.parent.document.getElementById("link1").innerHTML;document.getElementById('upper2').href  = x;document.getElementById('upper2').title = y;

Just what I needed; and I have used 'self.opener.parent' to get back to 'index.html'. It all works properly now.Thanks again.<a href="page2.html" onclick="window.open('page2.html','_self');return false"</a>However, if I call the page as above (in order to open the page in the same browser tab), I end up with a null reference again. Is there a way around this?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...