HTML點擊按鈕button跳轉(zhuǎn)頁面的四種方法
發(fā)布時間:2023-06-27 16:08:00 作者:圓圓01
我要評論

這篇文章主要介紹了HTML點擊按鈕button跳轉(zhuǎn)頁面的四種方法,每種方法結(jié)合實例代碼給大家介紹的非常詳細,需要的朋友可以參考下
其實我比較喜歡第一種方法
<button onclick="window.location.href='../routeEdit/index.html'" type="button" id="add">新增</button>
正文
方法一:在button標(biāo)簽中加上onclick屬性,賦值為Javascript
<input type="button" onclick='location.href=("index.aspx")' />//在本頁面打開 <input type="button" onclick='window.open("bedzhao.aspx")' />//打開新頁面 <button onclick="window.location.href='../routeEdit/index.html'" type="button" id="add">新增</button>
方法二:觸發(fā)一個函數(shù)跳轉(zhuǎn)
<script> function jump(){ window.location.; } </script> <input type="button" value="我是一個按鈕" οnclick=javascript:jump()>
方法三:a標(biāo)簽的超鏈接可以直接嵌套一個button
<a > <button>點我跳轉(zhuǎn)到度娘!</button> </a>
方法四:表單的action定向提交跳轉(zhuǎn)
<form action="xx.html" method="post"> <input type="button" value="按鈕"> </form>
還有其他方法,有些方法一些瀏覽器可能會不支持。
結(jié)尾
到此這篇關(guān)于HTML點擊按鈕button跳轉(zhuǎn)頁面的幾種實現(xiàn)方法的文章就介紹到這了,更多相關(guān)html點擊按鈕跳轉(zhuǎn)頁面內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!
相關(guān)文章
html頁面點擊按鈕實現(xiàn)頁面跳轉(zhuǎn)功能
這篇文章主要介紹了html頁面點擊按鈕實現(xiàn)頁面跳轉(zhuǎn)功能,本文通過實例代碼給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2023-07-13