至今未解决 高分求救(100)框架后退问题

bulargue 2006-09-20 11:04:02
我有一个框架页面A.asp为框架页面,包含三个框架子页面B.asp,C.asp,D.asp,
在B页面中点击一个连接,同时刷新C,D页面 , 变成E.asp和F.asp页面
当我点IE上的后退按钮时只是先后退F再后退E页面 不能实现同时后退

就是我点击一个连接后框架页面刷新多个页面 我想实现点击一次后退按钮 实现后退功能

第一次发贴 没发过 没经验 希望各位高手帮忙解决下
多谢各位了 我也不知道怎么给分 不知道给这些可以不 要是解决了怎么给解决的人的分啊??
...全文
248 15 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
「已注销」 2006-09-20
  • 打赏
  • 举报
回复
楼主是除了VS之外什么都不会的高人~~

VS把一些常用JS做成功能了~

反倒是最朴素最简洁的JS楼主不会~
「已注销」 2006-09-20
  • 打赏
  • 举报
回复
我晕~~
我一楼就给了你一种解决方法了,也不去看看~受不了……
飘零雾雨 2006-09-20
  • 打赏
  • 举报
回复
呵呵,先接点分!
flyingsnowy 2006-09-20
  • 打赏
  • 举报
回复
回复 | 收藏此页 | 专题 | 公告 | 管理 | 保存 | 关闭窗口



点管理就可以给分了。
bulargue 2006-09-20
  • 打赏
  • 举报
回复
slawdan(生猩猩咋就那么难捏~~) 说的也对 不能对浏览器上的按钮做什么
可你也不能让用户不用后退按钮啊 大家都习惯用这个按钮了
可是出现这个问题 不解决
用户还以为浏览器出问题了呢
bulargue 2006-09-20
  • 打赏
  • 举报
回复
谢谢大家帮忙啊
不过wmcode(欧阳乐天)可能没明白我的意思
我是想实现点一个连接 下面的两个页面进行跳转
然后点后退 两个页面同时后退回没点连接时的样子 就和普通网页后退一个意思
wmcode 2006-09-20
  • 打赏
  • 举报
回复
楼主看下我做的:

A.asp代码:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<frameset rows="80,*,80" frameborder="no" border="0" framespacing="0">
<frame src="B.asp" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />
<frame src="C.asp" name="mainFrame" id="mainFrame" title="mainFrame" />
<frame src="D.asp" name="bottomFrame" scrolling="No" noresize="noresize" id="bottomFrame" title="cFrame" />
</frameset>
<noframes><body>
</body>
</noframes></html>

B.asp代码:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function openwin(){
window.open("E.asp","mainFrame")
window.open("F.asp","bottomFrame")
}
</script>
</head>
<body>
<a href="#" onclick="openwin()">链接</a>
</body>
</html>

这样就可以了,当你点击链接时分别打开E.asp和F.asp,IE后退点一点时,F.asp退回D.asp,再点一次,E.asp退回C.asp
bulargue 2006-09-20
  • 打赏
  • 举报
回复
我用的是vs2005 页面跳转都是在.cs下操作的
楼上的代码也实用么
这样也可以实现么
「已注销」 2006-09-20
  • 打赏
  • 举报
回复
想在浏览器的后退钮上做文章是不现实的事情~~至少很麻烦……
「已注销」 2006-09-20
  • 打赏
  • 举报
回复
在A里面套一个后退按钮:
<input type=button value="后退" onclick="b();">

写一段JS:
<script language="javascript">
function b(){
c.history.go(-1); // c ,d 是包含C,D页面的框架的名字
d.history.go(-1);
}
</script>
tete 2006-09-20
  • 打赏
  • 举报
回复
用iframe可以实现么?
bulargue 2006-09-20
  • 打赏
  • 举报
回复
看来可能是我表达能力有问题了
我写下代码吧
A.asp //框架页面代码
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>框架</title>
</head>
<frameset name="head" rows="60,*">
<frame name="headframe" src="B.aspx?top=<%=Request.QueryString["top"]%>" scrolling="NO" noresize="">
<frameset name="mainframe" cols="215,*">
<frame name="left" src="C.aspx?page=1" scrolling="no" noresize="">
<frame name="right" src="D.aspx?col=1" scrolling="yes" noresize="">
</frameset>
</frameset>
<noframes>
<body topmargin="0" leftmargin="0">
<form id="form1" runat="server">
<div>

</div>
</form>
</body></noframes>
</body>
</html>
页面中每个部分都是通过传值确定其显示什么页面的
A.asp.cs //代码
public partial class FrontPage_MainPage_ManagerMainPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string s = Request["top"].ToString();
if (s == "1")
{
Response.Write("<script lanague=javascript>window.parent.headFrame.location.href='B.aspx?top=1'</script>");
}
else if (s == "2")
{
Response.Write("<script lanague=javascript>window.parent.headFrame.location.href='B.aspx?top=2'</script>");
}
else if (s == "3")
{
Response.Write("<script lanague=javascript>window.parent.headFrame.location.href='B.aspx?top=3'</script>");
}
...........
}
}
其中headframe部分引用页面B.asp
B.asp //页面代码
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>头</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table width="498" border="0" align="left" cellspacing="0" id="tab">
<tr>
<td width="50" height="30" ><div align="center">
<asp:ImageButton ID="ImageButton1" runat="server" Height="30px" ImageUrl="../../image/1-1.JPG"

OnClick="ImageButton1_Click" Width="50px" /><a href="javascript:;" target="_self" ></a></div></td>
<td width="50"><div align="center">
<asp:ImageButton ID="ImageButton2" runat="server" Height="30px" ImageUrl="../../image/2-1.JPG"

OnClick="ImageButton2_Click" Width="50px" /><a href="javascript:;" target="_self" ></a></div></td>
<td width="50"><div align="center">
<asp:ImageButton ID="ImageButton3" runat="server" Height="30px" ImageUrl="../../image/3-1.JPG"

OnClick="ImageButton3_Click" Width="50px" /><a href="javascript:;" target="_self" ></a></div></td>
<td width="50"><div align="center">
<asp:ImageButton ID="ImageButton4" runat="server" Height="30px" ImageUrl="../../image/4-1.JPG"

OnClick="ImageButton4_Click" Width="50px" /><a href="javascript:;" target="_self" ></a></div></td>
</tr>
</table>
</div>
</form>
</body>
</html>
通过A框架传过来的值是几判断该显示哪个按钮 点第一个按钮 C D 页面显示相应的内容
B.asp.cs //
public partial class B : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string s = Request["top"].ToString();
if (s == "1")
{
Response.Write("<script lanague=javascript>window.parent.topFrame.location.href='../TopBar/C.aspx?

col=1'</script>");
Response.Write("<script lanague=javascript>window.parent.leftup.location.href='../LeftUp/D.aspx?

page=1'</script>");
}
else if (s == "2")
{
Response.Write("<script lanague=javascript>window.parent.topFrame.location.href='../TopBar/C.aspx?

col=2'</script>");
Response.Write("<script lanague=javascript>window.parent.leftup.location.href='../LeftUp/D.aspx?

page=2'</script>");
}
else if (s == "3")
{
Response.Write("<script lanague=javascript>window.parent.topFrame.location.href='../TopBar/C.aspx?

col=3'</script>");
Response.Write("<script lanague=javascript>window.parent.leftup.location.href='../LeftUp/D.aspx?

page=3'</script>");
}
........
}
}

C.asp //页面代码
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>主</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Panel ID="Panel1" runat="server" Height="10px" Width="1020px">
</asp:Panel>
</div>
</form>
</body>
</html>
C.asp.cs //代码
public partial class C : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string s = Request["page"].ToString();
if (s == "1")
{
Panel1.BackColor = Color.FromArgb(0,153,153);
}
else if (s == "2")
{
Panel1.BackColor = Color.FromArgb(153,102,153);
}
else if (s == "3")
{
Panel1.BackColor = Color.FromArgb(102,153,0);
}
........
}
}
D.asp //D页面与C类似代码
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>主</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Panel ID="Panel1" runat="server" Height="10px" Width="1020px">
</asp:Panel>
</div>
</form>
</body>
</html>
D.asp.cs //代码
public partial class D : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string s = Request["col"].ToString();
if (s == "1")
{
Panel1.BackColor = Color.FromArgb(0,153,153);
}
else if (s == "2")
{
Panel1.BackColor = Color.FromArgb(153,102,153);
}
else if (s == "3")
{
Panel1.BackColor = Color.FromArgb(102,153,0);
}
........
}
}


基本上就这样 点B页面上的按钮linkbutton1后 C D页面显示相应的东西(c.asp?page=1 d.asp?col=1)
在点linkbutton2后 C D页面显示相应的东西(c.asp?page=2 d.asp?col=2)

这个时候问题出现了 当我点浏览器上的后退按钮时 点第一次 只是后退D页面到(d.asp?col=1)
点第二次后退到(c.asp?page=1) 在点一次后退才能完全回到点linkbutton1后的效果

我想实现点一次浏览器上的后退按钮就实现后退到点linkbutton1的效果 现在能不能明白呢??
网上这个问题我找了一个星期也没找到有解决答案的
谢谢大家了
wmcode 2006-09-20
  • 打赏
  • 举报
回复
当然,为了保险也可以在E.asp中加入:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function openwin(){
window.open("F.asp","mainFrame");
}
</script>
</head>
<body onload="openwin()">
</body>
</html>
wmcode 2006-09-20
  • 打赏
  • 举报
回复
先前没看清楚楼主说的,呵呵,其实可以根据具体情况具体来分析:
如果总是点B.asp页上的链接打开E.asp和F.asp,后退时一定要退回C.asp和D.asp的话,可以在
F.asp中加入如下代码:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function openwin(){
window.open("C.asp","mainFrame");
}
</script>
</head>
<body onload="openwin()">
</body>
</html>
bulargue 2006-09-20
  • 打赏
  • 举报
回复
楼上的说的我知道
你是要在页面上加个按钮啊
可是那要是用户点浏览器上的后退键不是还是会出现毛病么
这个问题怎么解决啊

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧