JS 页面刷新数据

2025-05-05 07:54:48
推荐回答(4个)
回答1:

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.
____________________________________________
框架页中:(框架页中其中一个子页)
top.location.reload(); 刷新整页
self.location.reload(); 刷新本页
window.parent.location.href='' 框架页重定向
_____________________________________________
自动刷新页面的方法:1.页面自动刷新:把如下代码加入区域中其中20指每隔20秒刷新一次页面. 开窗时刷新 关闭时刷新。
例:数据添加成功后弹出对话框并刷新页面
if (infoAction_Sort.Insert(info_Sort))
{
ScriptManager.RegisterStartupScript(this.UpdatePanel, this.GetType(), "alert", "alert('相册分类添加成功');window.location.reload();", true);

//Alert("相册分类创建成功");
//Response.Redirect(Request.Url.ToString());//刷新本页
this.txt_AddSort.Text = "";
this.txt_SortDepict.Text = "";
}

回答2:

我们每请求一个页面,浏览器都会将它保存在本地
就这样保存了一个又一个。
javascript:history.go(-3) 的意思是,返回前3个去,
浏览器会把那个文件直接显示给你,而不是发一个请求,也不执行什么
所以这是不行的,建议你把javascript:history.go(-3)换成跳转.

回答3:

你要重新定义你的FORM的ONSUBMIT事件的,重新装载数据。

回答4:

document.getElementById("刷新的控件id名字(如LinkButton1)").click();