页面布局类似于下图:

frame间传值

其中整个页面布局是main.html,代码如下:

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Untitled Document</title>
</head>
<frameset rows="20%,*">
  <frame src="http://www.baidu.com" name="top" />
   </frameset>
 </frameset>
</html>

右边页面4.html页面代码如下:

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
  444444444444
</body>
</html>


左边页面3.html页面代码为:

<body>
 <script type="text/javascript">
  function reload(dd){
     parent.frames["right"].location.href = dd;
  }
 </script>
  <div> <a href="#" onclick="reload('http://www.baidu.com')">点击更改</div>
</body>
</html>

其中在3.html页面中添加链接,并在点击的时候调用reload()方法。将需要传的值填进去。这时只要点击点击更改链接即可将右边页面变成网易的页面。如下所示:

frame间传值

相关文章:

  • 2022-01-12
  • 2021-08-04
  • 2021-09-15
  • 2021-12-11
  • 2021-10-12
  • 2022-12-23
  • 2021-04-18
猜你喜欢
  • 2021-08-23
  • 2021-07-07
  • 2021-09-29
  • 2021-11-17
  • 2021-10-09
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案