05-02-2006, 11:23 PM
Hi, ive got 1 div field in a iframe, and i got another iframe trying to adjust that div field, i am using
parent.document.getElementById("THEFIELD").innerHTML = WHATEVER;
which i guess is wrong because it isnt working :D any clue what to do ?
05-03-2006, 03:54 AM
There are possibly 2 problems with this,
the first is that 'getElementById' returns a pointer to the object so if you want to use this you will have to do
the_div = parent.iframe_1.document.getElementById("THEFIELD");
the_div.innerHTML = WHATEVER;
Note that you probably don't need to get the element by id, you should be able to set the innerHTML directly as seen in the example below.
The other Problem could be that because the div is in an iframe you need to include the name of the iframe in the code to access the div.
For example if the div "div_1" is in "iframe_1" and you are trying to do something with it from "iframe_2" the code might need to be
parent.iframe_1.div_1.innerHTML = WHATEVER;
Hope this helps, let me know how you get on.