ifram自适应屏幕分辨率代码

0 views
Skip to first unread message

Wayn...@gmail.com

unread,
Feb 26, 2009, 10:16:56 PM2/26/09
to 就是怕忘了
<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>
Reply all
Reply to author
Forward
0 new messages