0

我正在使用加载方法在我的网站中加载网页。

// main.js
$(document).ready(function ()
{
    $("#content").html("<object data='http://tired.com/'>");
});

// index.html
<html>

<head>

    <script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
    <script src="scripts/main.js"></script>

    <style type="text/css">

#container{
    width: 100%;
    height: 100%;
}

#content{
    margin-top: 10;
    margin-left: 100;
    margin-bottom: 10;
    margin-right: 10;

    width: 500px;
    height: 500px;
}

    </style>

</head>

<title>
Testing loading a html page into a div
</title>

<body>

    <div id="container">

        <div id="top">
            <p> Top </p>
        </div>

        <div id="content">
        </div>

        <div id="bottom">
            <p> Bottom </p>
        </div>

    </div>

</body>

</html>

尽管为contentdiv 提供了 500px 的高度和宽度,但网页仍以原始大小加载。

我怎样才能让它变大?

谢谢。

4

2 回答 2

0

它确实有效,检查这个小提琴。 JSFiddle 演示链接

您可能还想增加px利润。

#content{
    margin-top: 10px;
    margin-left: 100px;
    margin-bottom: 10px;
    margin-right: 10px;
    background:skyblue;
    width: 500px;
    height: 500px;
    padding:10px;
}
于 2013-07-08T20:20:13.563 回答
-1

我建议尝试在对象标签本身上设置样式:

#content object {
    width: 500px;
    height: 500px;
}
于 2013-07-08T20:20:06.303 回答