给button加href

版权声明:本文为博主原创文章,转载请附上博文链接! https://blog.csdn.net/csdnluolei/article/details/84069418

有的操作很简单就是简单的跳转,不想单独再写js就给button加连接href简单些

在原窗口跳转到新网址

<button onclick="window.location.href='http://www.baidu.com'">按钮</button>

打开新窗口跳转到新网址

<button onclick="window.open('http://www.baidu.com')">按钮</button>

猜你喜欢

转载自blog.csdn.net/csdnluolei/article/details/84069418