<!DOCTYPE html PUBLIC "- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Getting IFrame Window Reference With contentWindow</title>
<script type="text/javascript" src="jquery-1.3.2.js"></script>
<script type="text/javascript">
$(
function(){
var jFrame = $( "<iframe name='my-frame'>" );
var objDoc = null;
jFrame
.css( "width", "400px" )
.css( "height", "100px" )
.appendTo( $( "body" ) )
;
objDoc = window.frames[ "my-frame" ].document;
objDoc.write( "Gotten via FRAMES <br />" );
objDoc = jFrame[ 0 ].contentWindow.document;
objDoc.write( "Gotten via contentWindow <br />" );
objDoc.close();
}
);
</script>
</head>
<body>
<h1>
Getting IFrame Window Reference With contentWindow
</h1>
<p>
An iFrame will be added below this:
</p>
</body>
</html>