其实我比较喜欢第一种方法

<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>

方法二:触发一个函数跳转

<script>
    function jump(){
        window.location.href="http://blog.sina/mleavs";
    }
</script>
<input type="button" value="我是一个按钮" οnclick=javascript:jump()>

方法三:a标签的超链接可以直接嵌套一个button

<a href="https://www.baidu/">
    <button>点我跳转到度娘!</button>
</a>

方法四:表单的action定向提交跳转

<form action="xx.html" method="post">
    <input type="button" value="按钮">
</form>

还有其他方法,有些方法一些浏览器可能会不支持。

结尾

我是圆圆,如果我的文章对你的学习成长有所帮助,欢迎 点 赞 👍 支持,您的 点 赞 👍 支持是我进行创作和分享的动力!

如果有问题可以留言评论或者私信我,我都会一一解答~笔芯🤞

参考

  • https://blog.csdn/tjh625/article/details/81235827
  • https://blog.csdn/weixin_44025103/article/details/90017593

更多推荐

HTML点击按钮button跳转页面的几种实现方法