Here is my code on http://my-localhost.com/iframe-test.html
Welcome Iframe Test
You cannot access the DOM of a page loaded in a frame in a different origin. This is blocked for security reasons (imagine a random website you visited opening your web mail service in a hidden iframe and you can see why).
The closest you can come, and then only if you control both websites, is to pass messages between them using the web messaging api.
In one page, write a function to handle the messages and then add it as a message event listener.
function receiveMessage(event)
{
alert(event.data);
}
addEventListener("message", receiveMessage, false);
In the other, send the message:
parent.postMessage("This is a message", "*");
See MDN for more information