frameset和frame框架标记

frameset不能写在body标签中

frame是单标签

设置frame的src属性;a标签的target属性要对应frame的name属性。

一 .实现

left.php

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>左侧内容</title>
</head>
<body>
<a href="yule.php" target="right1" >娱乐</a>
<a href="tiyu.php" target="right1">体育</a>
<a href="caijing.php" target="right1">财经</a>
</body>
</html>

tiyu.php

<?php
 echo "体育";
?>

yule.php

<?php
  echo "娱乐";
?>

caijing.php

<?php
  echo "财经";
?>

frame.html (frameset不要写在body中)

<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
    <title>Title</title>
</head>
  <frameset cols="200,*">
      <frame name="left1" src='left.php'>
      <frame name='right1' src="caijing.php">
  </frameset>
</html>

 效果:

二. 框架嵌套

frame.html

<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
    <title>Title</title>
</head>
  <frameset rows="60,*">
      <frame name="top1" src='tiyu.php'>
      <frameset cols="200,*">
        <frame name='bottom1' src="yule.php">
        <frame name='bottom2' src='caijing.php'>
      </frameset>
  </frameset>
</html>

效果:

猜你喜欢

转载自blog.csdn.net/Lyj1010/article/details/82763243
今日推荐