Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: div fields not working
05-03-2006, 12:23 AM #1
- Join Date
- Jul 2005
- Thanked 0 Times in 0 Posts
div fields not working
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 any clue what to do ?
05-03-2006, 04:54 AM #2
- Join Date
- May 2005
- New Zealand
- Thanked 6 Times in 6 Posts
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
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.Code:the_div = parent.iframe_1.document.getElementById("THEFIELD"); the_div.innerHTML = WHATEVER;
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
Hope this helps, let me know how you get on.Code:parent.iframe_1.div_1.innerHTML = WHATEVER;