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

<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程序中,如为页面按钮写返回上一页代码

ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('Add a comment successful');javascript:history.go(-2);</script>");

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

posted @ 2013-08-14 11:34  C&Y Across I  阅读(366)  评论(0编辑  收藏  举报