js返回上一頁并刷新的多種實(shí)現(xiàn)方法
更新時(shí)間:2014年02月26日 15:56:25 作者:
這篇文章主要介紹了js返回上一頁并刷新的幾種方法,需要的朋友可以參考下
<a href="javascript:history.go(-1)">返回上一頁</a>
<a href="javascript:location.reload()">刷新當(dāng)前頁面</a>
<a href="javascript:" onclick="history.go(-2); ">返回前兩頁</a>
<a href="javascript:" onclick="self.location=document.referrer;">返回上一頁并刷新</a>
<a href="javascript:" onclick="history.back(); ">返回上一頁</a>
頁面跳轉(zhuǎn):
onclick="window.location.href='list.php'"
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
自動(dòng)刷新頁面的方法:
1.頁面自動(dòng)刷新:把如下代碼加入<head>區(qū)域中
<meta http-equiv="refresh" content="10">
10指每隔10秒刷新一次頁面.
2.頁面自動(dòng)跳轉(zhuǎn):把如下代碼加入<head>區(qū)域中
<meta http-equiv="refresh" content="10;url=http://www.baidu.com">
10指隔10秒后跳轉(zhuǎn)到http://www.baidu.com頁面
js自動(dòng)刷新當(dāng)前頁面:
<script language="JavaScript">
function myrefresh()
{
window.location.reload();
}
setTimeout('myrefresh()',1000); //指定1秒刷新一次
</script>
JS刷新框架的腳本語句
//刷新包含該框架的頁面用
<script language=JavaScript>
parent.location.reload();
</script>
//子窗口刷新父窗口
<script language=JavaScript>
self.opener.location.reload();
</script>
( 或 <a href="javascript:opener.location.reload()">刷新</a> )
//如何刷新另一個(gè)框架的頁面用
<script language=JavaScript>
parent.另一FrameID.location.reload();
</script>
要關(guān)閉窗口時(shí)刷新或開窗時(shí)刷新,在<body>中調(diào)用以下語句即可:
<body onload="opener.location.reload()"> 開窗時(shí)刷新
<body onUnload="opener.location.reload()"> 關(guān)閉時(shí)刷新
<script language="javascript">
window.opener.document.location.reload()
</script>
<a href="javascript:location.reload()">刷新當(dāng)前頁面</a>
<a href="javascript:" onclick="history.go(-2); ">返回前兩頁</a>
<a href="javascript:" onclick="self.location=document.referrer;">返回上一頁并刷新</a>
<a href="javascript:" onclick="history.back(); ">返回上一頁</a>
頁面跳轉(zhuǎn):
onclick="window.location.href='list.php'"
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
自動(dòng)刷新頁面的方法:
1.頁面自動(dòng)刷新:把如下代碼加入<head>區(qū)域中
<meta http-equiv="refresh" content="10">
10指每隔10秒刷新一次頁面.
2.頁面自動(dòng)跳轉(zhuǎn):把如下代碼加入<head>區(qū)域中
<meta http-equiv="refresh" content="10;url=http://www.baidu.com">
10指隔10秒后跳轉(zhuǎn)到http://www.baidu.com頁面
js自動(dòng)刷新當(dāng)前頁面:
復(fù)制代碼 代碼如下:
<script language="JavaScript">
function myrefresh()
{
window.location.reload();
}
setTimeout('myrefresh()',1000); //指定1秒刷新一次
</script>
JS刷新框架的腳本語句
復(fù)制代碼 代碼如下:
//刷新包含該框架的頁面用
<script language=JavaScript>
parent.location.reload();
</script>
//子窗口刷新父窗口
<script language=JavaScript>
self.opener.location.reload();
</script>
( 或 <a href="javascript:opener.location.reload()">刷新</a> )
//如何刷新另一個(gè)框架的頁面用
<script language=JavaScript>
parent.另一FrameID.location.reload();
</script>
要關(guān)閉窗口時(shí)刷新或開窗時(shí)刷新,在<body>中調(diào)用以下語句即可:
復(fù)制代碼 代碼如下:
<body onload="opener.location.reload()"> 開窗時(shí)刷新
<body onUnload="opener.location.reload()"> 關(guān)閉時(shí)刷新
<script language="javascript">
window.opener.document.location.reload()
</script>
相關(guān)文章
關(guān)于JSON解析的實(shí)現(xiàn)過程解析
這篇文章主要介紹了關(guān)于JSON解析的實(shí)現(xiàn)過程解析,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-10-10
微信小程序使用toast消息對話框提示用戶忘記輸入用戶名或密碼功能【附源碼下載】
這篇文章主要介紹了微信小程序使用toast消息對話框提示用戶忘記輸入用戶名或密碼功能,結(jié)合實(shí)例形式詳細(xì)分析了toast組件實(shí)現(xiàn)消息提示功能的相關(guān)操作技巧,并附帶源碼供讀者下載參考,需要的朋友可以參考下2017-12-12
JS實(shí)現(xiàn)紙牌發(fā)牌動(dòng)畫
這篇文章主要為大家詳細(xì)介紹了JS實(shí)現(xiàn)紙牌發(fā)牌動(dòng)畫,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-01-01
js動(dòng)態(tài)生成表格(節(jié)點(diǎn)操作)
這篇文章主要為大家詳細(xì)介紹了js動(dòng)態(tài)生成表格,進(jìn)行節(jié)點(diǎn)操作,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-01-01
JavaScript實(shí)現(xiàn)QueryString獲取GET參數(shù)的方法
本文為大家詳細(xì)介紹下如何通過JavaScript實(shí)現(xiàn)QueryString獲取GET參數(shù),具體實(shí)現(xiàn)如下,感興趣的朋友可以參考下哈,希望對大家有所幫助2013-07-07
JavaScript數(shù)組扁平轉(zhuǎn)樹形結(jié)構(gòu)數(shù)據(jù)(Tree)的實(shí)現(xiàn)
本文主要介紹了JavaScript數(shù)組扁平轉(zhuǎn)樹形結(jié)構(gòu)數(shù)據(jù)(Tree)的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2022-08-08
Three.js實(shí)現(xiàn)3D乒乓球小游戲(物理效果)
本文將使用React Three Fiber 和 Cannon.js 來實(shí)現(xiàn)一個(gè)具有物理特性的乒乓球小游戲,使用 React Three Fiber 搭建基礎(chǔ)三維場景、如何使用新技術(shù)棧給場景中對象的添加物理特性等,最后利用上述知識點(diǎn),將開發(fā)一個(gè)簡單的乒乓球小游戲,需要的朋友可以參考下2023-03-03

