HTML中button標籤點擊實現頁面跳轉

方法1:使用onclick事件javascript

<input type="button" value="按鈕" 
onclick="javascrtpt:window.location.href='http://www.baidu.com/'" />

  或者直接使用button標籤java

<button onclick="window.location.href = 'https://www.baidu.com/'">百度</button>

方法2:在button標籤外套一個a標籤函數

<a href="http://www.baidu.com/">
    <button>百度</button>
</a>

  或使用blog

<a href="http://www.baidu.com/"><input type="button" value='百度'></a>

方法3:使用JavaScript函數事件

<script>
function jump(){
 window.location.href="http://www.baidu.com/";
}
</script>
<input type="button" value="百度" onclick=javascrtpt:jump() />
// 或者<input type="button" value="百度" onclick="jump()" />
// 或者<button onclick="jump()">百度</button>
相關文章
相關標籤/搜索