The code you posted is fine, that is to say it contains no obvious mistakes or typos and works as expected when the two iframes are on the same domain.
I therefore conclude that either a) it is a cross domain scripting issue, or b) another factor is at play.
Chrome always complains when you violate the same origin policy, so why not open your page in Chrome and have a look at what your console is saying.