利用javascript返回查询页面保持原来的查询条件和数据
2011-04-06 13:12
453 查看
直接返回history.back();或者history.go(-1);
回自动保存的
C#代码中返回上级页面
this.ClientScript.RegisterStartupScript(GetType(), "alert", "alert('修改成功');history.go(-2)", true);
<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)那就是刷新这两个属于JS代码,相当于IE的前进、后退功能。
具体的用处就要看什么时候需要这个就用上。比如用户注册时的验证是后台验证,不符合要求的时候就可以用这个,可以最大限度保证用户少重复输入数据。
例如:载入页面:
function onLoadPage(){
if(event.srcElement.tagName=="SPAN"){
oFrame=top.window.middle.frames[2];
oTxt=event.srcElement.innerText;
switch(oTxt){
case "前 进":
oFrame.history.go(1);
case "后 退":
oFrame.history.back();
case "刷 新":
oFrame.location.reload();
}
}
}
打开一个jsp页面,肯定是用客户端脚本进行刷新了。
Javascript刷新页面的几种方法:
1 history.go(0)
2 location.reload()
3 location=location
4 location.assign(location)
5 document.execCommand('Refresh')
6 window.navigate(location)
7 location.replace(location)
8 document.URL=location.href
回自动保存的
C#代码中返回上级页面
this.ClientScript.RegisterStartupScript(GetType(), "alert", "alert('修改成功');history.go(-2)", true);
javascript:history.go()和History.back()的区别
<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)那就是刷新这两个属于JS代码,相当于IE的前进、后退功能。
具体的用处就要看什么时候需要这个就用上。比如用户注册时的验证是后台验证,不符合要求的时候就可以用这个,可以最大限度保证用户少重复输入数据。
例如:载入页面:
function onLoadPage(){
if(event.srcElement.tagName=="SPAN"){
oFrame=top.window.middle.frames[2];
oTxt=event.srcElement.innerText;
switch(oTxt){
case "前 进":
oFrame.history.go(1);
case "后 退":
oFrame.history.back();
case "刷 新":
oFrame.location.reload();
}
}
}
打开一个jsp页面,肯定是用客户端脚本进行刷新了。
Javascript刷新页面的几种方法:
1 history.go(0)
2 location.reload()
3 location=location
4 location.assign(location)
5 document.execCommand('Refresh')
6 window.navigate(location)
7 location.replace(location)
8 document.URL=location.href
相关文章推荐
- 返回查询页面保持原来的查询条件和数据
- Java抓取网页数据(原来的页面+Javascript返回数据)
- Java抓取网页数据(原来的页面+Javascript返回数据)
- Atitit.列表页面and条件查询的实现最佳实践(1)------设置查询条件and提交查询and返回json数据
- Atitit.列表页面and条件查询的实现最佳实践(1)------设置查询条件and提交查询and返回json数据
- HQL 查询数据 (获取页面输入的查询条件字段)
- 关于页面查询条件保持的思考(一)
- hibernate新增后数据库能查到数据但跳转查询页面后还是原来的数据
- Spring-JDBC:在使用JdbcTemplate进行条件查询时没有返回数据,但是sql直接在数据库中执行是有数据返回的。
- domino利用AJAX取后台数据并返回到页面
- ASP.NET MVC WebApi 返回数据类型序列化控制(json,xml) 用javascript在客户端删除某一个cookie键值对 input点击链接另一个页面,各种操作。 C# 往线程里传参数的方法总结 TCP/IP 协议 用C#+Selenium+ChromeDriver 生成我的咕咚跑步路线地图 (转)值得学习百度开源70+项目
- ajax根据ID查询数据库并返回Json格式数据返回js,使用append显示到页面。判断json值为[]或者[[]]的问题。
- php查询mysql中的数据,并将结果返回为JSON格式,提取JSON中的数据,写入页面不同的id号中
- 在hibernate3中如何利用HQL语句查询出对象中的部分数据并且返回该对象?
- jquery.dataTables 按条件查询后重新生成表格 点击排序还是原来的数据问题
- MongoDB查询内嵌数组(限定返回符合条件的数组中的数据)(1)
- Atitit.列表页and查询条件的最佳实践(1)------设定搜索条件and提交查询and返回json数据
- ###(很难找的页面错误)查询操作不需要 返回 操作成功后失败。【方法不能同时执行两个response返回两次数据。导致页面显示数据失败】
- android 开发利用 html5 JavascriptInterface 实现应用层与 native 互传参数并获取返回数据
- 利用es-head 删除指定查询条件中的数据