本文主要和大家分享頁面跳轉小結詳解,希望能幫助大家更好掌握頁面跳轉知識。
HTML標簽
一般形式上可以用<a></a>
、<button></button>
、<input/>
:
<a href="鏈接">GO</a> <button onclick="window.location.href='鏈接'">GO</button> <input type="button" value="GO" onclick="location.href='鏈接'">
JS跳轉頁面代碼
本頁跳轉
window.location.href = '鏈接'; window.location = '鏈接'; location.href = '鏈接'; location = '鏈接'; top.location = '鏈接';
新頁跳轉
window.open('鏈接'); open('鏈接');
或者在HTML標簽中添加target="_blank"
:
<a href="鏈接" target="_blank">GO</a>
歷史跳轉
<a href="history.go(-1)">返回上一步</a> <a href="window.history.back()">返回上一步</a>
相關推薦:
微信小程序頁面跳轉事件綁定實例詳解
Router解決跨模塊下的頁面跳轉
微信小程點擊文字實現頁面跳轉功能的方法
以上就是頁面跳轉小結詳解的詳細內容,更多請關注php中文網其它相關文章!