HTML框架集:框架集在新选项卡/窗口中打开

时间:2013-08-31 15:02:04

标签: html css frameset

自上周以来我一直在考虑如何使用框架集来解决我的问题。

方案:

我有一个带有自己背景颜色的页眉,页脚,菜单和内容的html文件。我使用框架集进行了更好的设计。

我的标题的背景颜色为黑色,页脚也为黑色,菜单为灰色且内容只是纯白色。

一切正常但我在菜单中看到了问题,当用户使用在新标签页中打开链接在新标签中打开链接单击主页时窗口主页的设计只是白色。

问题:

当用户点击链接时,使用在新标签页中打开链接在新窗口中打开链接,是否还可以使用四个html文件的背景颜色包括?

这是我的frameset代码:

<frameset rows="120,*,30" border ="0">
<frame name ="top" src="header.php">

</frame>

<frameset cols="200,*" border ="0">
<frame src="menu_viewer.php" name="menu">
<frame src="index.php" name="main" scrolling="yes">
</frame>
</frameset>

<frame name="bottom" src="footer.php">

</frameset>

这是我设计的版画屏幕:

enter image description here

当用户点击在新标签页中打开链接在新窗口中打开链接 时,结果

enter image description here

正确的结果应为:

enter image description here

任何建议或推荐程序,只要设计结果如此,也欢迎。谢谢你。

2 个答案:

答案 0 :(得分:0)

@ Princess Toledo:HTML5现在不支持框架集。如果你在css中这样做,那么使用你的代码的包装器,即

<body>
<div id=wrapper>
<!-- your code -->
</div>
</body>

并将css包装为

#wrapper {
  width:980px;
  margin: auto;
 }

这将保持您的内容适合页面中心的wrapper,并且不会在高分辨率窗口中崩溃。

答案 1 :(得分:0)

如果你的框架集文件名为frameset.php,你可以这样修改它

&#13;
&#13;
<frameset rows="120,*,30" border ="0">
<frame name ="top" src="header.php">

</frame>

<frameset cols="200,*" border ="0">
<frame src="menu_viewer.php" name="menu">

<?php if (isset($_GET['main'])): ?>
<frame src="<?php echo $_GET['main']; ?>" name="main" scrolling="yes">
<?php else: ?>
<frame src="index.php" name="main" scrolling="yes">
<?php endif; ?>

</frame>
</frameset>

<frame name="bottom" src="footer.php">

</frameset>
&#13;
&#13;
&#13;

然后对每个页面文件,插入一个顶部框架检查。 例如,对于文件index.php,请插入以下代码:

&#13;
&#13;
<script>
if(self==top){
  self.location = "frameset.php?main=index.php";
}
</script>
&#13;
&#13;
&#13;

并向文件playlist.php插入此代码:

&#13;
&#13;
<script>
if(self==top){
  self.location = 'frameset.php?main=playlist.php';
}
</script>
&#13;
&#13;
&#13;

等等其他页面文件。

我希望你明白这一点。

相关问题