按test2.html的button可以同时刷新2个frame,也可以刷新当前frame,
但是如何只刷新top这个frame呢
index.jsp </head>
<frameset rows="50%,50%">
<frame src="test1.html" name="top">
<frame src="test2.html" name="bottom">
</frameset>
<body>
This is my JSP page. <br>
</body>
</html>test1.html<script language="javascript" type="text/javascript">
alert('sx');
function refresh()
{
alert("refresh1");
}
</script>
</head>
<body>
111111111111111111111
<input type=button value="refresh1" onclick=refresh() >
</body>
</html>
test2.html<title>Insert title here</title>
<script language="javascript" type="text/javascript">
alert('bbbbb');
function refresh()
{
//刷新整个页面
// self.parent.frames["top"].location.reload();
//刷新当前frame
// document.location.reload();
}
</script>
</head>
<body>
222222222222222222
<input type=button value="refresh2" onclick=refresh()>
</body>
</html>
但是如何只刷新top这个frame呢
index.jsp </head>
<frameset rows="50%,50%">
<frame src="test1.html" name="top">
<frame src="test2.html" name="bottom">
</frameset>
<body>
This is my JSP page. <br>
</body>
</html>test1.html<script language="javascript" type="text/javascript">
alert('sx');
function refresh()
{
alert("refresh1");
}
</script>
</head>
<body>
111111111111111111111
<input type=button value="refresh1" onclick=refresh() >
</body>
</html>
test2.html<title>Insert title here</title>
<script language="javascript" type="text/javascript">
alert('bbbbb');
function refresh()
{
//刷新整个页面
// self.parent.frames["top"].location.reload();
//刷新当前frame
// document.location.reload();
}
</script>
</head>
<body>
222222222222222222
<input type=button value="refresh2" onclick=refresh()>
</body>
</html>
{ parent.document.getElementsByTagName('frame')[0].contentWindow.location.reload();
//刷新整个页面
//self.parent.frames["top"].location.reload();
//刷新当前frame
// document.location.reload();
}