|
|
全部信息 |
当前位置:首页 → 网站制作知识 → 详细内容 |
|
|
iframe 动态改变框架高度 |
|
更新时间:2013/1/24 点击:2008次 |
- <iframe src="test.asp" width="100%" frameborder="0" scrolling="no" name="hj" id="hj"></iframe>
- test.asp页面head间增加如下JS代码
- <SCRIPT LANGUAGE="JavaScript">
- function f_frameStyleResize(targObj){
- var targWin = targObj.parent.document.all[targObj.name];
- if(targWin != null) {
- var HeightValue = targObj.document.body.scrollHeight
- if(HeightValue < 600){HeightValue = 600}
- targWin.style.pixelHeight = HeightValue;
- }
- }
- function f_iframeResize(){
- bLoadComplete = true; f_frameStyleResize(self);
- }
- var bLoadComplete = false;
- window.onload = f_iframeResize;
- </SCRIPT>
|
|
|
|
|
|
|