<a href="javascript:history.go(-1)">返回上一頁</a>
<a href="javascript:location.reload()">刷新當前頁面</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>
頁面跳轉:
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
自動刷新頁面的方法:
1.頁面自動刷新:把如下代碼加入<head>區域中
<meta http-equiv="refresh" content="10">
10指每隔10秒刷新一次頁面.
2.頁面自動跳轉:把如下代碼加入<head>區域中
<meta http-equiv="refresh" content="10;url=http://www.baidu.com">
10指隔10秒后跳轉到http://www.baidu.com頁面
js自動刷新當前頁面:
<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> )
//如何刷新另一個框架的頁面用
<script language=JavaScript>
parent.另一FrameID.location.reload();
</script>
要關閉窗口時刷新或開窗時刷新,在<body>中調用以下語句即可:
<body onload="opener.location.reload()"> 開窗時刷新
<body onUnload="opener.location.reload()"> 關閉時刷新
<script language="javascript">
window.opener.document.location.reload()
</script>
<a href="javascript:location.reload()">刷新當前頁面</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>
頁面跳轉:
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
自動刷新頁面的方法:
1.頁面自動刷新:把如下代碼加入<head>區域中
<meta http-equiv="refresh" content="10">
10指每隔10秒刷新一次頁面.
2.頁面自動跳轉:把如下代碼加入<head>區域中
<meta http-equiv="refresh" content="10;url=http://www.baidu.com">
10指隔10秒后跳轉到http://www.baidu.com頁面
js自動刷新當前頁面:
<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> )
//如何刷新另一個框架的頁面用
<script language=JavaScript>
parent.另一FrameID.location.reload();
</script>
要關閉窗口時刷新或開窗時刷新,在<body>中調用以下語句即可:
<body onload="opener.location.reload()"> 開窗時刷新
<body onUnload="opener.location.reload()"> 關閉時刷新
<script language="javascript">
window.opener.document.location.reload()
</script>
鏈接: http://www.jb51.net/article/47315.htm
============
history.go(-1)和History.back()的區別:
簡單的說就是:go(-1): 返回上一頁,原頁面表單中的內容會丟失;back(-1): 返回上一頁,原頁表表單中的內容會保留,一般還是back(-1)用的多
============
history.back(-1):直接返回當前頁的上一頁,數據全部消息,是個新頁面
history.go(-1):也是返回當前頁的上一頁,不過表單里的數據全部還在
history.back(0) 刷新 history.back(1) 前進 history.back(-1) 后退
window.location.reload(); //刷新
window.history.go(1); //前進
window.history.go(-1); //返回+刷新
window.history.forward(); //前進
window.history.back(); //返回
===================
<a class="js_go_back"><i class="nav-menu-btn"></i></a>
//點擊返回
$('.js_go_back').on('tap', function(event) {
event.preventDefault();
window.history.go(-1);
return false;
});
============
javaScript返回上一頁代碼區別:
1
2
3
4
5
|
window.history.go(-1);
//返回上一頁
window.history.back();
//返回上一頁
//如果要強行刷新的話就是:window.history.back();location.reload();
window.location.go(-1);
//刷新上一頁
|