在很多系统中,都会存在从查询页面跳转至详情或者查看页面的情况,在从查看页面返回时用户不想要查询页面进行了刷新,这样页面直接跳转则达不到这种要求
可以通过frame方式,进行显示的控制,并不是真正的进行跳转,那么页面不会进行刷新
代码实现如下:
base页面
<head>
<script language="javascript">
function showPage(type,url)
{
if(type=="1")
{
frmMain.rows="0,*";
}
else
{
frmMain.rows="*,0";
}
document.all.frame2.src=url;
}
</script>
</head>
<frameset rows="*,0" border="0" id="frmMain">
<frame name="frame1" src="Index.html" scrolling="auto">
<frame name="frame2" src="" noresize scrolling="auto">
<noframes>
<pre id="p2"></pre>
</noframes>
</frameset>
查询页面:
<head>
<script>
function GoToUrl()
{
if (parent != null && parent.showPage != null)
{
parent.showPage(1,"view.html");
}
else
{
// 不存在框架转入则直接转入
opennewwin("view.html", 700, 600);
} // end if
}
</script>
</head>
<body>
<h1>查询页面</h1>
<input type="button" name="button" οnclick="javascript:GoToUrl(); return false;" value="查看"/>
</body>
查看页面:
<head>
<script>
function returnback()
{
parent.showPage(0,"index.html");
}
</script>
</head>
<body>
<h2>这是查看页面</h2>
<input class="button" type="button" runat="server" id="btnBack" οnclick="javascript:returnback(); return false;"
value="返回" />
</body>