Click to See Complete Forum and Search --> : change style classes in an iframe


Adrian
06-04-2004, 06:46 PM
Hi friends !
I've got a problem changing the stylesheets in a iframe inside my page.

Here's the Deal:
My page has 3 iframes inside a table, and I want to change the color of a class in one of them by clicking a button. The bgcolor of the document inside the iframe I change with no problems using a function like this:

function changebg() {
document.frames("frame2").document.body.style.backgroundColor = document.FormName.TextInput.value;
}

I use a form to retrieve the value of the bgcolor, and it's outside the iframes, and trigger it with a button with the onclick event that changes the bgcolor of the selected iframe.

But to change the color of the class (it is a class for some links in the page inside the iframe), I was trying to do something like this in the same function:

document.frames("frame2").document.classes.ClassName.style.Color = document.options.TextInput2.value;

and it was not working.

To change only the color of the text I can do by using the same syntax as the changebg() function, using body.style.Color, but since the class I want to change is used for links, I couldn't use this script.

Now here's the question:

Can I change a color value of a class in a stylesheet inside an iframe directly from the page? If yes ,how ?
And to change the color onhover?
Is it the same way to change bgimages ?
Am I using the correct syntax to access the class ?

I think that if I can change the value of the bgcolor atribute of the body in the stylesheet, I can assign a value to other classes in the stylesheet, but I'm not sure how. Can anybody help me ?