<iframe id="contentframe" src="@ViewBag.Url" height="1000px" frameborder="0" width="100%" allowtransparency scrolling="no">
</iframe>
<script type="text/javascript">

    $(function () {
        try {
            var frame = document.getElementById("contentframe");
            frame.onreadystatechange = function () {
                if (this.readyState == "complete")

                    var ifm = document.getElementById("contentframe");
                var subWeb = document.frames ? document.frames["contentframe"].document : ifm.contentDocument;
                if (ifm != null && subWeb != null) {
                    ifm.height = subWeb.body.scrollHeight;
                }
            }

        }
        catch (err) {            
            $("#contentframe").attr("height", 1000);
        }
    })
</script>

 

posted on 2013-03-30 12:23  阿拉伯顶峰  阅读(1699)  评论(0编辑  收藏  举报