我在网上找了很多相关的解决方案,并且也试过了。但为什么都不起作用呢。
高度一直是默认的160,我没有设定他的高度啊
<script type="text/javascript">
function SetCwinHeight()
{
try{
var bobo=document.getElementById("ifram123"); //iframe id
if (document.getElementById)
{
if (bobo && !window.opera)
{
if (bobo.contentDocument && bobo.contentDocument.documentElement.offsetHeight)
{
bobo.height = bobo.contentDocument.documentElement.offsetHeight+30;
}
else if(bobo.Document && bobo.Document.body.scrollHeight)
{
bobo.height = bobo.Document.body.scrollHeight+300;//40是空白,可根据需要自己改
}
}
}
}catch(err)
{}
}
</script> <iframe id="ifram123" name="myframe" scrolling="auto" onload="SetCwinHeight()" width="100%" style="border:0px; " frameborder="0" src="http://www.67dajie.com"> 求解
高度一直是默认的160,我没有设定他的高度啊
<script type="text/javascript">
function SetCwinHeight()
{
try{
var bobo=document.getElementById("ifram123"); //iframe id
if (document.getElementById)
{
if (bobo && !window.opera)
{
if (bobo.contentDocument && bobo.contentDocument.documentElement.offsetHeight)
{
bobo.height = bobo.contentDocument.documentElement.offsetHeight+30;
}
else if(bobo.Document && bobo.Document.body.scrollHeight)
{
bobo.height = bobo.Document.body.scrollHeight+300;//40是空白,可根据需要自己改
}
}
}
}catch(err)
{}
}
</script> <iframe id="ifram123" name="myframe" scrolling="auto" onload="SetCwinHeight()" width="100%" style="border:0px; " frameborder="0" src="http://www.67dajie.com"> 求解
<iframe name="lanrentuku" src="http://www.lanrentuku.com/" frameborder=false scrolling="auto" width="100%" height="100%" frameborder=no onload="document.all['lanrentuku'].style.height=lanrentuku.document.body.scrollHeight+100" ></iframe>
$(document).ready(function () {
//设置iframe 高,宽
$('#ifram123').css({
height: $(document).height() + 'px',
width: $(document).width()+ 'px'
});
});
</script>
呵呵。