Computing.Net > Forums > Web Development > Simple Javasricpt Help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Simple Javasricpt Help

Reply to Message Icon

Name: TheMASTER69
Date: January 18, 2009 at 21:28:22 Pacific
OS: Windows XP
CPU/Ram: Intel 1.4ghz; 504mb
Product: Dell / Insperion
Subcategory: Javascript/Ajax
Comment:

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-



Sponsored Link
Ads by Google

Response Number 1
Name: shutat
Date: January 19, 2009 at 10:42:16 Pacific
Reply:

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]


0

Response Number 2
Name: TheMASTER69
Date: January 22, 2009 at 14:13:13 Pacific
Reply:

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 = 10 to var count = 12] and [var chase = true to var chase = false]

if theres anyway to do this please help


0

Response Number 3
Name: shutat
Date: January 23, 2009 at 16:41:41 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: Simple Javasricpt Help

Simple CSS help? www.computing.net/answers/webdevel/simple-css-help/228.html

How to make pics lighter/darker?? www.computing.net/answers/webdevel/how-to-make-pics-lighterdarker/905.html

Simple ASP Form- Help Needed! www.computing.net/answers/webdevel/simple-asp-form-help-needed/963.html