欧美亚洲中文,在线国自产视频,欧洲一区在线观看视频,亚洲综合中文字幕在线观看

      1. <dfn id="rfwes"></dfn>
          <object id="rfwes"></object>
        1. 站長資訊網(wǎng)
          最全最豐富的資訊網(wǎng)站

          js怎么跳轉(zhuǎn)到指定頁面?

          跳轉(zhuǎn)方法:1、使用“l(fā)ocation.href="指定頁面的URL";”語句跳轉(zhuǎn);2、使用“l(fā)ocation.replace("指定頁面的URL");”語句跳轉(zhuǎn);3、使用“l(fā)ocation.assign("指定頁面的URL");”語句跳轉(zhuǎn)。

          js怎么跳轉(zhuǎn)到指定頁面?

          推薦教程:《JavaScript視頻教程》

          方法1:使用window.location.href方式進(jìn)行跳轉(zhuǎn)

          該種方法可以直接跳轉(zhuǎn)指定頁面。

          <script type="text/javascript"> window.location.href = "https://www.php.cn"; </script>

          window可省略,可簡寫為:

          location.href="URL"

          方法2:使用window.loction.replace方式進(jìn)行跳轉(zhuǎn)

          語法:

          window.location.replace("url") //可簡寫為 location.replace("url")

          將地址替換成新 url,該方法通過指定 URL 替換當(dāng)前緩存在歷史里(客戶端)的項(xiàng)目,因此當(dāng)使用 replace 方法之后,你不能通過"前進(jìn)"和"后退"來訪問已經(jīng)被替換的URL,這個(gè)特點(diǎn)對于做一些過渡頁面非常有用!

          示例

          <script type="text/javascript"> window.location.replace("https://www.php.cn") </script>

          方法3:使用location.assign方式進(jìn)行跳轉(zhuǎn)

          assign()方法加載一個(gè)新的文檔。

          語法:

          location.assign(URL)

          示例:

          <script type="text/javascript"> window.location.assign("https://www.php.cn") </script>

          方法4:使用window.navigate方式進(jìn)行跳轉(zhuǎn)

          語法:

          window.navigate("url");

          navigate對象包含有關(guān)瀏覽器的信息,也可以作為頁面跳轉(zhuǎn),后面直接加要跳轉(zhuǎn)的地方。

          示例:

          <script language="javascript"> window.navigate("b.html"); </script>

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