JS+CSS浮动框架加载连接自适应宽高

很久以前发布在CSDN上的一个简单案例,今天看来非常粗糙,所以下载下来完善了一下,欢迎吐槽!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta content="text/html; charset=gb2312" http-equiv="Content-Type" />
    <meta content="IE=EmulateIE7" http-equiv="X-UA-Compatible" />
    <title>TinTao - 飒易互联</title>
    <style type="text/css">
    *,html{
        padding: 0;
        margin: 0;
    }
    html{
        overflow: hidden;
    }
    </style>
</head>

<body>
    <div class="fbd">
        <iframe id="ibox" src="http://www.saecn.com" frameborder="0" width="100%" height="506"></iframe>
    </div>
</body>
<script src='http://code.jquery.com/jquery-1.10.0.min.js' type="text/javascript" language="javascript"></script>
<script type="text/javascript">
    setFrameH();
    window.onresize = function() {
        setFrameH();
    };
    function setFrameH(){
        var $ibox = $("#ibox");
        var height = $(window).height();
        if (height < 0)
            height = 1;
        $ibox.height(height);
    }
</script>
</html>

在线案例请移动这里:JS+CSS浮动框架加载连接自适应宽高

  1. 一个懒惰的少年将来就是一褴褛的老人。

  1. 暂无 Trackback

return top