<!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></title>
</head>
<body>
<iframe id="ifream" name="ifream" src="b.htm" width="100%" frameborder="0"></iframe>
</body>
</html>
b.htm
<!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>
<script src="JS/jquery-1.4.2.js" type="text/javascript"></script>
<title>无标题页</title>
</head>
<body>
<!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 runat="server">
<title>无标题页</title>
</head>
<body>
我是嵌套页面,我想自适应高度。看着我啊
<script>
jQuery(function () {
parent.document.getElementById("ifream").style.height = jQuery(document).height()+"px";
});
</script>
</body>
</html>
看到了吧,关键就在于
1.frameborder="0"
2.parent.document.getElementById("ifream").style.height = jQuery(document).height()+"px";