Using CSS to affect div style inside iframe

You need JavaScript. It is the same as doing it in the parent page, except you must prefix your JavaScript command with the name of the iframe.

Remember, the same origin policy applies, so you can only do this to an iframe element which is coming from your own server.

I use the Prototype framework to make it easier:

frame1.$('mydiv').style.border="1px solid #000000"

or

frame1.$('mydiv').addClassName('withborder')

Leave a Comment