hebsxl2000 2012-09-05 09:21 采纳率: 0%
浏览 289
已采纳

请问如何自动设置iframe的高度

[code="javascript"]
$(".workPanel .tabs .tabs-content").append("

");

var iframe = document.getElementsByName("ifram")[0];
try{
var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
alert(bHeight+","+dHeight);
var height = Math.max(bHeight, dHeight);
iframe.height = height + 20;
}catch (ex){}
[/code]

请问我这么写有什么问题吗?

  • 写回答

2条回答 默认 最新

  • jinnianshilongnian 2012-09-05 15:39
    关注

    [code="java"]



    [/code]
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?