追求新生活 名字2008

活着的意义

返回上一页代码用法小结

以前在asp中,返回上一页代码一般用在超连接处用

<a href="javascript:history.go(-1);">

在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”。跟直接写脚本的有所不同。

如果有些是三层的话,就-3,如此类推.

posted on 2008-12-15 11:42  pyman  阅读(921)  评论(0编辑  收藏  举报

导航