Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I working on my website and i have a iFrame showing another page...
I need to change the javascript variables of the iFrame page...
The catch is i dont have write access to the iFrame page only the page containing the iFrame...
Any way to make this possible will be GREATLY appriciated...
-TheMASTER69-

You might try something as below. You can usually setup some event elsewhere to trigger swapping the src... it doesn't have to be a click on the iframe. You'd also probably want to set the initial source of the frame.
<script language="javascript"> function change(src) { document.getElementById("ifrm").src = src; } </script> <iframe id="ifrm" src="#" onclick="change('some_url');"></iframe>HTH
[edit]Oops; I misread the post. Does the other page parse a query string? I'm not sure otherwise; I apologize
[/edit]

ugh i dont think so here but i'll try to explain it again...
My page (page1) contains a iframe to (page2). I cannot change the javascript variables of page2 because it's write-protected. But i can write to page1. The variables i need to change of page2 from page1 are [var
count = 10to var count = 12] and [varchase = trueto var chase = false]if theres anyway to do this please help

If doc2 (its url) doesn't belong to the same domain as doc1, then from what I've read, you'll get an access denied error when trying to read any of the properties within doc2. That's to prevent spreading malicious code across domains.
If both docs reside in the same domain, then you can reference its object with something like:
try { var ifrm = document.getElementById("id").contentDocument; for(i=0; i < ifrm.childNodes.length; i++) { alert(ifrm.childNodes[i]); } } catch(e) { alert(e); }Check the nodes against the list here to see what is accessible.
Hope that helps.

![]() |
Apache Not Sending Pages
|
creating a server
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |