...

View Full Version : how to get across



jeromepelletier
05-03-2006, 09:41 PM
How would i go abouts storing a javascript variable from one iframe to another, then retrieving it in another? Reson is im refreshing 1 iframe, displaying on another and sending it to another to check for changes.....i cant get it to work right :S

Mr J
05-04-2006, 01:58 PM
Take a look here, this may help you

www.huntingground.freeserve.co.uk/webplus/iframes/iframe_pass_data2.htm

Thompson
05-04-2006, 05:49 PM
just remebering, you can use this property on frames too, not just on iframes.
:thumbsup:

jeromepelletier
05-04-2006, 07:58 PM
uhmmm what i wanted was to store a value in a variable in another page..not an input

such as

iframe 1: var whatever

iframe 2: changes what var whatever is in iframe 1

iframe 3: gets var whatever fromiframe 1

Beagle
05-04-2006, 08:03 PM
Well, I'm not positive, and I'd have to do some tests to verify this but:

The running context of each script is the window that it is executed in. I believe that iframes and regular frames are separate running contexts from each other. Therefore you must end up treating the frames as objects with properties and methods (parent.frames[0].variable or parent.frames[1].method(param) ).

Unless they are publicly accessible on an object, they aren't accessible except within the running context, and as per my belief, each frame has its own context.

Mr J
05-04-2006, 10:53 PM
The inputs are only examples, all you have to do is change

document.FormName.ElementName.value

to the variables name and assign it the appropriate value in the relative iframe

Try the examples in the attached zip

jeromepelletier
05-05-2006, 12:44 AM
The inputs are only examples, all you have to do is change

document.FormName.ElementName.value

to the variables name and assign it the appropriate value in the relative iframe

Try the examples in the attached zip
the page im displaying on is being changed from another page, ive done

parent.frames['FRAME'].DIVID.innerHTML=WHATEVER;

it works on IE but not firefox..any idea why?

jeromepelletier
05-05-2006, 12:49 AM
the page im displaying on is being changed from another page, ive done

parent.frames['FRAME'].DIVID.innerHTML=WHATEVER;

it works on IE but not firefox..any idea why?
guess i should elaborate...the part where i display it doesnt change but when i call it up as a variable and display it in a alert its fine..

Mr J
05-05-2006, 01:49 PM
parent.frames['FRAME'].DIVID.innerHTML=WHATEVER;

will only work in IE for firefox you need

parent.frames['FRAME'].document.getElementById(DIVID).innerHTML=WHATEVER;

If this still does not work post your code or zip your files and attach here

jeromepelletier
05-05-2006, 04:27 PM
parent.frames['FRAME'].DIVID.innerHTML=WHATEVER;

will only work in IE for firefox you need

parent.frames['FRAME'].document.getElementById(DIVID).innerHTML=WHATEVER;

If this still does not work post your code or zip your files and attach here
just gives me an undefined error....hmmmmmmm ima try something if not ill be back :)

Alrighty, i was able to fix it by just comparing 2 variables changed on the same page and changing the whole pages innerHTML on the on the one i was changing :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum