我制作html页面,我希望它的内容在我的index.html页面中显示在框架中,我使用javascript根据内容调整框架大小我不想使用滚动条但是iframe不会调整大小内容我没有看到我的包含页面的所有内容这个HTML代码:
<html>
<head>
<script language="javascript" type="text/javascript">
function resizeIframe(obj) {
obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
}
</script>
</head>
<body>
<div id="mainContentContainer" >
<div id="leftPart">
<div id="leftpartContent">
<iframe src="./cursies.html" id="iframe1"frameborder="0" scrolling="no" width="725" height="500" style="position:absolute;padding-left:-60px;bacground-color:#ffffff;"
src="./cursies.html" name="content" id="content " class="content" onload='javascript:resizeIframe(this);' />
</div>
</div>
</div>
</body>
<html>
此网页我想要包含在iframe中:
<!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>
<title>Brighton Sea Cruises </title>
<link rel="stylesheet" type="text/css" href="style2.css" media="all">
</head>
<body>
<span class="text"> Brighton Sea Cruises </span>
<p style="font-family: Arial, Helvetica, sans-serif;font-size: 14px;
color: #636466;">remier quality cruising company. <br>
We offer cruises, concerts, parties, celebrations and much more.<br>
Our larger boat "The Belle" is available for private hire, birthday party cruises, Stag & Hen parties, anniversaries, weddings, corporate presentations, group days-out.<br>
These include public daily 90 minute cruises along the Brighton coast.
There are also occasional jazz music days and comedy nights arranged where the public can attend upon purchase of a ticket on the day.<br>
Private hire and party cruises are more like 3 hours and the entertainment can be pre-arranged through our Events Managers.<br>
Our smaller boat "The Lady" is available for fishing trips, both pre-booked and to turn on on the day and pay. These are usually 8-hr trips starting 07:30am.
Fishing trips to suit novices and experienced fishermen, sometimes on shorter 4-hr trips on summer afternoons.<br>
We always operate from the Brighton Marina from West Jetty, near the Chinese Pagoda restaurant.<br>
Passenger boarding is done at Pontoon 4 on West Jetty near Wetherspoons pub.
</p>
</body>
</html>
这是样式代码:
.text{ font-size: 36px; font-family: Arial, Helvetica, sans-serif;
color: #636466;}
你可以测试它并检查问题在哪里,我看到一个以上的解决方案来调整stackoverflow和谷歌的iframe但同样的问题