Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
两个iFrame一卷_Iframe - Fatal编程技术网

两个iFrame一卷

两个iFrame一卷,iframe,Iframe,我有两个iFrame,一个在另一个上面 每个iframe加载不同的页面 iframe1是标题 iframe2是内容 渴望 表现为一页,因此当您滚动整个页面时 发行 只有最下面的一个滚动 有办法做到这一点吗 <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Untitled</title>

我有两个iFrame,一个在另一个上面

  • 每个iframe加载不同的页面
  • iframe1是标题
  • iframe2是内容
渴望

  • 表现为一页,因此当您滚动整个页面时
发行

  • 只有最下面的一个滚动
有办法做到这一点吗

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>Untitled</title>
            <style type="text/css">
            body, html
            {
                margin: 0; padding: 0; 
            }

            #content
            {
                position:absolute; left: 0; right: 0; bottom: 0; top: 90px; background: blue; height: expression(document.body.clientHeight-90); overflow:hidden;
            }
        </style>
</head>
<body>

    <iframe src="http://www.example.com" width="100%" height="100" frameborder="0" scrolling="no"></iframe><br />

     <div id="content">
        <iframe src="http://www.cnn.com" width="100%" height="100%" frameborder="0"></iframe>
    </div>
</body>
</html>

无标题
正文,html
{
边距:0;填充:0;
}
#内容
{
位置:绝对;左:0;右:0;底部:0;顶部:90px;背景:蓝色;高度:表达式(document.body.clientHeight-90);溢出:隐藏;
}


如果您可以选择PHP,则可以使用include()函数从其他文件导入页眉和正文内容。这将把两个页面组成一个页面,并将所有页面作为一个页面滚动

这样做的一个缺点(从您已经在做的事情来看)是,无论何时从页面主体跟随超链接,标题都会重新加载到下一页。 (相对于页眉是静态的,而不是每次导航到新页面时都刷新)


同样,您可以将主体的内容放在该文件中

<?php
  // Page Header
  include("headerfile.html");
?>
<!--content html goes here-->

<?php
  // Page Header
  include("headerfile.html");
?>
<!--content html goes here-->