JavaScript常用的返回,自動(dòng)跳轉(zhuǎn),刷新,關(guān)閉語句匯總
本文實(shí)例講述了JavaScript常用的返回,自動(dòng)跳轉(zhuǎn),刷新,關(guān)閉語句。分享給大家供大家參考。具體如下:
1. Javascript 返回上一頁:
2. 后退:
3. 返回下一頁:
4. 返回第幾頁,也可以使用訪問過的URL:
例:
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):
P.S.
小技巧(JS引用JS):
<!--
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ū)域中
其中20指每隔20秒刷新一次頁面.
2.頁面自動(dòng)跳轉(zhuǎn):把如下代碼加入<head>區(qū)域中
其中20指隔20秒后跳轉(zhuǎn)到http://www.fzitv.net頁面
3.頁面自動(dòng)刷新js版
function myrefresh()
{
window.location.reload();
}
setTimeout('myrefresh()',1000); //指定1秒刷新一次
</script>
ASP.NET如何輸出刷新父窗口腳本語句
1.
2.
3.
JS刷新框架的腳本語句
<script language=JavaScript>
parent.location.reload();
</script>
子窗口刷新父窗口:
self.opener.location.reload();
</script>
或者:
如何刷新另一個(gè)框架的頁面用:
parent.另一FrameID.location.reload();
</script>
如果想關(guān)閉窗口時(shí)刷新或者想開窗時(shí)刷新的話,在<body>中調(diào)用以下語句即可。
開窗時(shí)刷新:
關(guān)閉時(shí)刷新:
window.opener.document.location.reload()
</script>
JS關(guān)閉當(dāng)前頁面, 不彈出JS安全提醒
window.opener=null;window.open('','_self','');window.close();
</script>
希望本文所述對(duì)大家的javascript程序設(shè)計(jì)有所幫助。
相關(guān)文章
javascript禁止訪客復(fù)制網(wǎng)頁內(nèi)容的實(shí)現(xiàn)代碼
這篇文章主要介紹了javascript禁止訪客復(fù)制網(wǎng)頁內(nèi)容的方法,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-08-08
HTML頁面定時(shí)跳轉(zhuǎn)方法解析(2種任選)
本文主要對(duì)HTML頁面定時(shí)跳轉(zhuǎn)進(jìn)行方法介紹:1、meta refresh 實(shí)現(xiàn)。2、JavaScript 實(shí)現(xiàn)。具有很好的參考價(jià)值,需要的朋友一起來看下吧2016-12-12
js簡(jiǎn)單實(shí)現(xiàn)Select互換數(shù)據(jù)的方法
這篇文章主要介紹了js簡(jiǎn)單實(shí)現(xiàn)Select互換數(shù)據(jù)的方法,涉及javascript動(dòng)態(tài)操作select中option節(jié)點(diǎn)的相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-08-08

