js frameset demo

将一个页面分成四个页面,每个framey通过src属性引用对应的页面。首先我在Test5.html文件中写框架代码

<frameset rows="*,*" cols="*,*">
<frame name="top_left" src="Test4.html">
<frame name="top_right" src="Test1.html"  >
<frame name="bottom_left" src="">
<frame name="bottom_right" src="">
</frameset>

然后在Test4中写了一些代码,定义了三个按钮,点击之后对应的frame会出现一个标题和一段文字。

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Frame Test</title>
<script type="text/javascript">
function FillFrame(framename){
theframe=parent[framename];
theframe.document.open();
theframe.document.write("<h1>JavaScript Output</h1>");
theframe.document.write("<p>The text is in the ");
theframe.document.write(framename+" frame.</p>");

}

</script>
</head>
<body>
<h1>Frame Test</h1>
<form name="form1"></form>
<input type="button" value="Top Right" οnclick="FillFrame('top_right');">
<input type="button" value="bottom Left" οnclick="FillFrame('bottom_left');">
<input type="button" value="bottom Right" οnclick="FillFrame('bottom_right');">
 
</body>
</html>

三个按钮点击了之后的截图如下.上传截图之后发现图片不能自动缩略,csdn需要改进啊。。。




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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值