刷新頁面的幾種方法小結(jié)(JS,ASP.NET)
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>區(qū)域中
<meta http-equiv="refresh" content="20">
其中20指每隔20秒刷新一次頁面.
2.頁面自動跳轉(zhuǎn):把如下代碼加入<head>區(qū)域中
<meta http-equiv="refresh" content="20;url=http://jay-xu33.cnblogs.com/">
其中20指隔20秒后跳轉(zhuǎn)到http://jay-xu33.cnblogs.com/頁面
3.頁面自動刷新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> )
//如何刷新另一個框架的頁面用
<script language=JavaScript>
parent.另一FrameID.location.reload();
</script>
如果想關(guān)閉窗口時刷新或者想開窗時刷新的話,在<body>中調(diào)用以下語句即可。
<body onload="opener.location.reload()"> 打開窗口時刷新
<body onunload="opener.location.reload()"> 關(guān)閉窗口時刷新
<script language="javascript">
window.opener.document.location.reload()
</script>
相關(guān)文章
childNodes.length與children.length的區(qū)別
childNodes.length與children.length的值常不一樣。2009-05-05微信小程序?qū)崿F(xiàn)image組件圖片自適應(yīng)寬度比例顯示的方法
這篇文章主要介紹了微信小程序?qū)崿F(xiàn)image組件圖片自適應(yīng)寬度比例顯示的方法,簡單講述了image組件的常用屬性,并結(jié)合實(shí)例形式分析了微信小程序?qū)崿F(xiàn)圖片自適應(yīng)寬度比例的相關(guān)操作技巧,需要的朋友可以參考下2018-01-01JavaScript實(shí)現(xiàn)輪播圖片完整代碼
這篇文章主要為大家介紹了JavaScript實(shí)現(xiàn)輪播圖片的完整代碼,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2020-03-03jq.ajax+php+mysql實(shí)現(xiàn)關(guān)鍵字模糊查詢(示例講解)
下面小編就為大家分享一篇jq.ajax+php+mysql實(shí)現(xiàn)關(guān)鍵字模糊查詢(示例講解),具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-01-01JavaScript是如何實(shí)現(xiàn)繼承的(六種方式)
大多OO語言都支持兩種繼承方式: 接口繼承和實(shí)現(xiàn)繼承 ,而ECMAScript中無法實(shí)現(xiàn)接口繼承,ECMAScript只支持實(shí)現(xiàn)繼承,而且其實(shí)現(xiàn)繼承主要是依靠原型鏈來實(shí)現(xiàn),下文給大家技術(shù)js實(shí)現(xiàn)繼承的六種方式,需要的朋友參考下2016-03-03