JS定時(shí)刷新頁面及跳轉(zhuǎn)頁面的方法
更新時(shí)間:2013年07月04日 15:11:03 作者:
這篇文章介紹了JS定時(shí)刷新頁面及跳轉(zhuǎn)頁面的方法,有需要的朋友可以參考一下
Javascript 返回上一頁
1. Javascript 返回上一頁 history.go(-1), 返回兩個(gè)頁面: history.go(-2);
2. history.back().
3. window.history.forward()返回下一頁
4. window.history.go(返回第幾頁,也可以使用訪問過的URL)
例:
<a href="javascript:history.go(-1);">向上一頁</a>
response.Write("<script language=javascript>")
response.Write("if(!confirm('完成任務(wù)?')){history.back();}")
response.Write("</script>")
response.Write("<script language=javascript>history.go(-1);</script>")
<a href="javascript:history.go(-1);">向上一頁</a>
//頁面跳轉(zhuǎn):
onclick="window.location.href='list.aspx'"
P.S.
小技巧(JS引用JS):
<script type=text/javascript>
<!--
if (typeof SWFObject == "undefined") {
document.write('<scr' + 'ipt type="text/javascript" src="/scripts/swfobject-1.5.js"></scr' + 'ipt>');}
//-->
</script>
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="20">
其中20指每隔20秒刷新一次頁面.
2.頁面自動(dòng)跳轉(zhuǎn):把如下代碼加入<head>區(qū)域中
<meta http-equiv="refresh" content="20;url=http://www.dhdzp.com">
其中20指隔20秒后跳轉(zhuǎn)到http://www.dhdzp.com/tools/files.shtml頁面
3.頁面自動(dòng)刷新js版
<script language="JavaScript">
function myrefresh()
{
window.location.reload();
}
setTimeout('myrefresh()',1000); //指定1秒刷新一次
</script>
ASP.NET如何輸出刷新父窗口腳本語句
//1.
this.response.write("<script>opener.location.reload();</script>");
//2.
this.response.write("<script>opener.window.location.href = opener.window.location.href;</script>");
//3.
Response.Write("<script language=javascript>opener.window.navigate(''你要刷新的頁.asp'');</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>
1. Javascript 返回上一頁 history.go(-1), 返回兩個(gè)頁面: history.go(-2);
2. history.back().
3. window.history.forward()返回下一頁
4. window.history.go(返回第幾頁,也可以使用訪問過的URL)
例:
復(fù)制代碼 代碼如下:
<a href="javascript:history.go(-1);">向上一頁</a>
response.Write("<script language=javascript>")
response.Write("if(!confirm('完成任務(wù)?')){history.back();}")
response.Write("</script>")
response.Write("<script language=javascript>history.go(-1);</script>")
<a href="javascript:history.go(-1);">向上一頁</a>
//頁面跳轉(zhuǎn):
onclick="window.location.href='list.aspx'"
P.S.
小技巧(JS引用JS):
復(fù)制代碼 代碼如下:
<script type=text/javascript>
<!--
if (typeof SWFObject == "undefined") {
document.write('<scr' + 'ipt type="text/javascript" src="/scripts/swfobject-1.5.js"></scr' + 'ipt>');}
//-->
</script>
Javascript刷新頁面的幾種方法:
復(fù)制代碼 代碼如下:
//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="20">
其中20指每隔20秒刷新一次頁面.
2.頁面自動(dòng)跳轉(zhuǎn):把如下代碼加入<head>區(qū)域中
<meta http-equiv="refresh" content="20;url=http://www.dhdzp.com">
其中20指隔20秒后跳轉(zhuǎn)到http://www.dhdzp.com/tools/files.shtml頁面
3.頁面自動(dòng)刷新js版
復(fù)制代碼 代碼如下:
<script language="JavaScript">
function myrefresh()
{
window.location.reload();
}
setTimeout('myrefresh()',1000); //指定1秒刷新一次
</script>
ASP.NET如何輸出刷新父窗口腳本語句
復(fù)制代碼 代碼如下:
//1.
this.response.write("<script>opener.location.reload();</script>");
//2.
this.response.write("<script>opener.window.location.href = opener.window.location.href;</script>");
//3.
Response.Write("<script language=javascript>opener.window.navigate(''你要刷新的頁.asp'');</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>
您可能感興趣的文章:
- js關(guān)閉模態(tài)窗口刷新父頁面或跳轉(zhuǎn)頁面
- JS在一定時(shí)間內(nèi)跳轉(zhuǎn)頁面及各種刷新頁面的實(shí)現(xiàn)方法
- js頁面跳轉(zhuǎn)常用的幾種方式
- js跳轉(zhuǎn)頁面方法實(shí)現(xiàn)匯總
- js點(diǎn)擊button按鈕跳轉(zhuǎn)到另一個(gè)新頁面
- jsp下頁面跳轉(zhuǎn)的幾種方法小結(jié)
- js跳轉(zhuǎn)頁面方法總結(jié)
- js實(shí)現(xiàn)頁面跳轉(zhuǎn)的幾種方法小結(jié)
- js實(shí)現(xiàn)頁面跳轉(zhuǎn)重定向的幾種方式
- JS實(shí)現(xiàn)頁面跳轉(zhuǎn)與刷新的方法匯總
相關(guān)文章
原生js jquery ajax請(qǐng)求以及jsonp的調(diào)用方法
下面小編就為大家?guī)硪黄鷍s jquery ajax請(qǐng)求以及jsonp的調(diào)用方法。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-08-08
JavaScript實(shí)現(xiàn)搜索的數(shù)據(jù)顯示
這篇文章主要為大家詳細(xì)介紹了JavaScript實(shí)現(xiàn)搜索的數(shù)據(jù)顯示,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-10-10
BootStrap數(shù)據(jù)表格實(shí)例代碼
本文通過實(shí)例代碼給大家分享了BootStrap數(shù)據(jù)表格的相關(guān)知識(shí),感興趣的朋友一起看看吧2017-09-09
原生javascript實(shí)現(xiàn)文件異步上傳的實(shí)例講解
下面小編就為大家?guī)硪黄鷍avascript實(shí)現(xiàn)文件異步上傳的實(shí)例講解。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-10-10
JS實(shí)現(xiàn)加載時(shí)鎖定HTML頁面元素的方法
這篇文章主要介紹了JS實(shí)現(xiàn)加載時(shí)鎖定HTML頁面元素的方法,涉及javascript針對(duì)頁面元素的遍歷與屬性操作相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下2017-06-06
JavaScript 瀏覽器對(duì)象模型BOM原理與常見用法實(shí)例分析
這篇文章主要介紹了JavaScript 瀏覽器對(duì)象模型BOM原理與常見用法,結(jié)合實(shí)例形式詳細(xì)分析了JavaScript瀏覽器對(duì)象模型BOM基本概念、原理、使用方法及操作注意事項(xiàng),需要的朋友可以參考下2019-12-12

