首頁  >  文章  >  web前端  >  jquery中怎麼跳頁

jquery中怎麼跳頁

王林
王林原創
2020-11-19 09:18:3010120瀏覽

jquery跳轉頁面的方法:透過使用屬性替換方法attr()或prop()來實現跳轉,如【$(location).attr('href', 'url位址')】、 【$(location).prop('href', 'url')】。

jquery中怎麼跳頁

本教學操作環境:windows7系統、jquery3.3.1版,此方法適用於所有品牌電腦。

jquery跳轉頁面的方法有以下幾種:

(學習影片分享:jquery影片教學

1.利用http的重定向來跳轉

window.location.replace("http://www.php.cn");

2、使用href來跳轉

window.location.href = "http://www.php.cn";

3、使用jQuery的屬性替換方法來實現跳轉

$(location).attr('href', 'http://www.php.cn');
$(window).attr('location','http://www.php.cn');
$(location).prop('href', 'http://www.php.cn')

相關推薦:js教學

#

以上是jquery中怎麼跳頁的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn