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

