B.htm 에 A 도메인 의 C.htm 을 iframe 으로 넣어줌!!
A.htm
-------------------------------------------------------------------
<script type="text/javascript">
function updateIFrame( height ) {
alert( 'Updating IFrame height to '+height );
var iframe = document.getElementById( 'myiframe' );
iframe.setAttribute( 'height', height );
}
</script>
<iframe src=http://B.com/B.htm width="400" height="100" id="myiframe">
-------------------------------------------------------------------
B.htm
-------------------------------------------------------------------
function getPage(){
var iframe = document.getElementById( 'inneriframe' );
var wrapper = document.getElementById( 'wrapper' );
var height = Math.max( document.body.offsetHeight, document.body.scrollHeight );
iframe.src = 'http://A.com/C.htm?height='+height;
}
-------------------------------------------------------------------
C.htm
-------------------------------------------------------------------
<script type="text/javascript">
function onLoad() {
var params = window.location.search.substring( 1 ).split( '&' );
var height;
for( var i = 0, l = params.length; i < l; ++i ) {
var parts = params[i].split( '=' );
switch( parts[0] ) {
case 'height':
height = parseInt( parts[1] );
break;
}
}
if( typeof( height ) == 'number' ) {
window.top.updateIFrame( height );
}
}
window.onload = onLoad;
</script>
-------------------------------------------------------------------
Post A Comment:
0 comments: