javascript当中frame和frameset的用法

1.frame和frameset(企业用的少了,所以视频略过,见后面iframe部分)
例 2.1.1(index.html)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head>
<!--col="221,*" means left column
 is 221, right column is any value.frameborder="no" 就没有border了-->
<frameset cols="221,*" frameborder="yes" border="1" bordercolor="#0066CC">
  <frame src="left.html" name="leftFrame" scrolling="No" noresize="noresize" id="leftFrame" title="leftFrame" />
  <frame src="main.html" name="mainFrame" id="mainFrame" title="mainFrame" />
</frameset>
<noframes>
<body>
noframes 元素可为那些不支持框架的浏览器显示文本。noframes 元素位于 frameset 元素内部。
</body>
</noframes></html>
left.html

alert("left");
</script>
</head>
<body>
<!--  Window.parent (Property)
A reference to the parent window in a framed pane.
Window.frames[] (Collection)有关这个, 参见bottom.html
qixy: note that parent point to index.html which has a  frameset, which has two framesets, one is frames[0], the other is frames[1]. so 1 is main.html.
Window.self (Property)
can refer to a frame as well as a window.
当我在left.html中加一个断点后, 我就发现这时的self,因为在左边的frame当中, 所以指left.html 
 -->
<INPUT TYPE="button" value="parent测试" οnclick="parent.frames[1].location='target1.html'">
<INPUT TYPE="button" value="self测试" οnclick="self.location='target1.html'">
</body>
</html>
main.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>


更多请见:https://blog.csdn.net/qq_43650923/article/details/103046330

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

mark_to_win

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值