javascript:history.go()和History.back()的区别

来源:互联网 发布:java调用http上传文件 编辑:程序博客网 时间:2024/05/17 01:38
 
  <input   type=button   value=刷新   onclick="window.location.reload()">  
  <input   type=button   value=前进   onclick="window.history.go(1)">  
  <input   type=button   value=后退   onclick="window.history.go(-1)">  
  <input   type=button   value=前进   onclick="window.history.forward()">  
  <input   type=button   value=后退   onclick="window.history.back()">
 
后退+刷新
<input   type=button   value=后退   onclick="window.history.go(-1);window.location.reload()">
在C# Web程序中,如为页面按钮写返回上一页代码

this.RegisterClientScriptBlock("E", "<script language=javascript>history.go(-2);</script>");

其中,history.go(-2),要写为-2,因在按钮事件触发前,已刷新一次页面,所以应是-2。

Response.Write("<script language=javascript>history.go(-2);</script>");

此处也要写为“-2”。跟直接写脚本的有所不同。
 
history.back()是会上一页
i=1
history.go(i)去指定的某夜
如果是history.go(0)那就是刷新
原创粉丝点击