HTML點(diǎn)擊按鈕button跳轉(zhuǎn)頁面的四種方法
發(fā)布時(shí)間:2023-06-27 16:08:00 作者:圓圓01
我要評(píng)論
這篇文章主要介紹了HTML點(diǎn)擊按鈕button跳轉(zhuǎn)頁面的四種方法,每種方法結(jié)合實(shí)例代碼給大家介紹的非常詳細(xì),需要的朋友可以參考下
其實(shí)我比較喜歡第一種方法
<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ā)一個(gè)函數(shù)跳轉(zhuǎn)
<script>
function jump(){
window.location.;
}
</script>
<input type="button" value="我是一個(gè)按鈕" οnclick=javascript:jump()>方法三:a標(biāo)簽的超鏈接可以直接嵌套一個(gè)button
<a >
<button>點(diǎn)我跳轉(zhuǎn)到度娘!</button>
</a>方法四:表單的action定向提交跳轉(zhuǎn)
<form action="xx.html" method="post">
<input type="button" value="按鈕">
</form>還有其他方法,有些方法一些瀏覽器可能會(huì)不支持。
結(jié)尾
到此這篇關(guān)于HTML點(diǎn)擊按鈕button跳轉(zhuǎn)頁面的幾種實(shí)現(xiàn)方法的文章就介紹到這了,更多相關(guān)html點(diǎn)擊按鈕跳轉(zhuǎn)頁面內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!
相關(guān)文章
html頁面點(diǎn)擊按鈕實(shí)現(xiàn)頁面跳轉(zhuǎn)功能
這篇文章主要介紹了html頁面點(diǎn)擊按鈕實(shí)現(xiàn)頁面跳轉(zhuǎn)功能,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2023-07-13

