将一个页面分成四个页面,每个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需要改进啊。。。