[JavaScript] Possible to change CSS styles in an iframe?

Hey all,

I’m really troubled by this right now. Is it possible to change CSS styles in an iframe on a page with Javascript from the main page?

What this means is I can’t edit the iframe, and I will only have access to the source of the main page.

I got it to work with a link, as follows:

<a onClick="frames.my_iframe.document.getElementById('myId').style.color = '#000000'; return false" href="#">change the iframe</a>

However, this does not work if I simply insert “frames.my_iframe.document.getElementById(‘myId’).style.color = ‘#000000’;” into a Javascript block. Why is this so?

Thanks in advance!

//edit. YES I’VE FIGURED IT OUT.