<table width="735" border="0" align="center" cellpadding="0" cellspacing="0">
<iframe frameborder='0' src="/album/albumDetail.jsp" border="0" scrolling='no' name="photoname" id="photoid" onload="this.width=document.frames['photoname'].document.body.scrollWidth;this.height=document.frames['photoname'].document.body.scrollHeight;">
</iframe>
</table>
这样好像不可以,如何根据src="/album/albumDetail.jsp"这个页面里的内容来自动控制ifram的高度?
如果src里的数据多高度就会自动的加高,否则自动减小,如何控制,我这样写的还是不能控制
<iframe frameborder='0' src="/album/albumDetail.jsp" border="0" scrolling='no' name="photoname" id="photoid" onload="this.width=document.frames['photoname'].document.body.scrollWidth;this.height=document.frames['photoname'].document.body.scrollHeight;">
</iframe>
</table>
这样好像不可以,如何根据src="/album/albumDetail.jsp"这个页面里的内容来自动控制ifram的高度?
如果src里的数据多高度就会自动的加高,否则自动减小,如何控制,我这样写的还是不能控制
将你的 jsp 文件代替为了 htm 文件试验了一下,你的方法十分正确呀!!!
如果说,你的意思是:
不仅仅是在第一次加载时,iframe 高度可变,
如果 jsp 页面根据不同的每次的操作不同而取不同的值,
从而页面会在以后的运用中不断改变,
这需要自适应,
这个我没试,
我想原理应该也差不多……你的代码很正确,不信,你先那个 htm 页面试试 !……
parent.document.getElementById("photoid").style.height=document.body.scrollHeight+20;
</script>