jquery教程

推荐列表 站点导航

当前位置:首页 > jquery > jquery教程 >

js刷新页面几种方法小结

来源:网络整理  作者:  发布时间:2020-12-22 20:05
本文介绍了javascript刷新页面的几种方法,包括reload、replace等方法,有需要的朋友参考下。...

js代码中实现刷新页面的方法,包括:
 

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,页面自动刷新:把如下代码加入<head>区域中<meta http-equiv="refresh" content="20">其中20指每隔20秒刷新一次页面。
 

复制代码 代码示例:

<body onload="opener.location.reload()"> 开窗时刷新
<body onunload="opener.location.reload()"> 关闭时刷新。

例:数据添加成功后弹出对话框并刷新页面
 

复制代码 代码示例:

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 = "";
}

相关热词: 方法

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://v30.fanwenzhu.com/jq/jc/7355.shtml

相关文章
最新文章
PHP识别相片是否是颠倒的 PHP识别相片是否是颠倒的

时间:2020-12-28

python编程有哪些ide python编程有哪些ide

时间:2020-12-28

python开发工程师是做什么 python开发工程师是做什么

时间:2020-12-28

php构造函数的作用 php构造函数的作用

时间:2020-12-28

php怎么跟数据库连接 php怎么跟数据库连接

时间:2020-12-28

php实现顺序线性表 php实现顺序线性表

时间:2020-12-28

Python多重继承中的菱形继 Python多重继承中的菱形继

时间:2020-12-28

php中break的作用 php中break的作用

时间:2020-12-28

Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

js刷新页面几种方法小结

2020-12-22 编辑:

js代码中实现刷新页面的方法,包括:
 

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,页面自动刷新:把如下代码加入<head>区域中<meta http-equiv="refresh" content="20">其中20指每隔20秒刷新一次页面。
 

复制代码 代码示例:

<body onload="opener.location.reload()"> 开窗时刷新
<body onunload="opener.location.reload()"> 关闭时刷新。

例:数据添加成功后弹出对话框并刷新页面
 

复制代码 代码示例:

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 = "";
}

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://v30.fanwenzhu.com/jq/jc/7355.shtml

相关文章

风云图片

推荐阅读

返回jquery教程频道首页