久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      javascript如何刷新頁面

      javascript刷新頁面的方法:1、使用“l(fā)ocation.reload()”;2、使用“l(fā)ocation.replace(location)”;3、使用“history.go(0)”;4、使用“l(fā)ocation=location”等。

      javascript如何刷新頁面

      本教程操作環(huán)境:windows7系統(tǒng)、ECMAScript 5版、Dell G3電腦。

      Javascript刷新頁面的幾種方法:

      • location.reload()

      • location.replace(location)

      • history.go(0)

      • location=location

      • location.assign(location)

      • document.execCommand('Refresh')

      • window.navigate(location)

      • document.URL=location.href

      下面詳細介紹一下reload和replace方法

      1,reload方法

      該方法強迫瀏覽器刷新當前頁面。

      語法:

      location.reload([bForceGet])

      參數(shù): bForceGet, 可選參數(shù), 默認為 false,從客戶端緩存里取當前頁。true, 則以 GET 方式,從服務端取最新的頁面, 相當于客戶端點擊 F5("刷新")

      2,replace方法

      方法通過指定URL替換當前緩存在歷史里(客戶端)的項目,因此當使用replace方法之后,你不能通過“前進”和“后退”來訪問已經(jīng)被替換的URL。

      語法:

       location.replace(URL)

      通常使用: location.reload() 或者是 history.go(0) 來做。

      此方法類似客戶端點F5刷新頁面,所以頁面method="post"時,會出現(xiàn)"網(wǎng)頁過期"的提示。 因為Session的安全保護機制。

      當調(diào)用 location.reload() 方法時, aspx頁面此時在服務端內(nèi)存里已經(jīng)存在, 因此必定是 IsPostback 的。

      如果有這種應用: 需要重新加載該頁面,也就是說期望頁面能夠在服務端重新被創(chuàng)建,期望是 Not IsPostback 的。

      這里,location.replace() 就可以完成此任務。被replace的頁面每次都在服務端重新生成。

      代碼:

      location.replace(location.href);

      返回并刷新頁面:

      location.replace(document.referrer); document.referrer //前一個頁面的URL

      不要用 history.go(-1),或 history.back();來返回并刷新頁面,這兩種方法不會刷新頁面。

      【推薦學習:js基礎教程】

      補:自動刷新或跳轉頁面的方法:

      1,頁面自動刷新:把如下代碼加入<head>區(qū)域中

      <meta http-equiv="refresh" content="20">       (其中20指每隔20秒刷新一次頁面.)

      2,頁面自動跳轉:把如下代碼加入<head>區(qū)域中

      <meta http-equiv="refresh" content="20;url=http://www.baidu.com">  (其中20指隔20秒后跳轉到http://www.baidu.comt頁面)

      3,頁面自動刷新js版

      <script type="text/javascript"> function myrefresh() {  window.location.reload(); } setTimeout('myrefresh()',1000); //指定1秒刷新一次 </script>

      4,JS刷新框架的腳本語句

      //刷新包含該框架的頁面用  <script type="text/javascript">  parent.location.reload(); </script> //子窗口刷新父窗口 <script type="text/javascript">  self.opener.location.reload(); </script> ( 或 <a href="javascript:opener.location.reload()" rel="external nofollow" >刷新</a> ) //刷新另一個框架的頁面用  <script type="text/javascript">  parent.另一FrameID.location.reload(); </script>

      如果想關閉窗口時刷新或想開窗時刷新,在<body>中調(diào)用以下語句即可

      <body onload="opener.location.reload()"> 開窗時刷新 <body onUnload="opener.location.reload()"> 關閉時刷新 <script>  window.opener.document.location.reload() </script>

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號