`

iframe嵌套

 
阅读更多

嵌套页面中的一个iframe:

<DIV>
	<IFRAME	src="" id="iframepage" name="iframepage" width="100%" align="center"
	   frameborder="0" scrolling="no" onLoad="iFrameHeight()" >
	</IFRAME>
</DIV>

 onload调用的函数:

function iFrameHeight() { 
	var ifm= document.getElementById("iframepage"); 
	var subWeb = document.frames ? document.frames["iframepage"].document : ifm.contentDocument; 
		if(ifm != null && subWeb != null) { 
			ifm.height = subWeb.body.scrollHeight; 
	}
        //取到被嵌套页面的某个元素,将其设置为隐藏
	var goBackButton = ifm.contentWindow.document.getElementById("goBackID");
	if(goBackButton!=undefined) {
		goBackButton.style.display="none"
	}
} 

 document.frames("iframepage").location="http://bepatient.javaeye.com";

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics