var ifrm = document.getElementById('ifrm'); // reference to window in the iframe var win = ifrm.contentWindow; // reference to document in iframe var doc = ifrm.contentDocument? ifrm.contentDocument: ifrm.contentWindow.document; // reference to a form named 'ifrmTest' in iframe var form = doc.getElementById('ifrmTest');
http://www.dyn-web.com/tutorials/iframes/refs.php