方法1:使用onclick事件
1
|
< input type = "button" value = "按钮" onclick = "javascrtpt:window.location.href=&#39;http://www.baidu.com/&#39;" > |
或者直接使用button标签
1
|
<button onclick= "window.location.href = &#39;https://www.baidu.com/&#39;" >百度</button> |
(推荐教程:html教程)
方法2:在button标签外套一个a标签
1
|
<a href= "http://www.baidu.com/" > <button>百度</button> </a> |
或使用
1
|
<a href= "http://www.baidu.com/" ><input type= "button" value= "&#39;百度&#39;" ></a> |
方法3:使用Javascript函数
1
|
<input type= "button" value= "百度" onclick= "javascrtpt:jump()" > // 或者<input type="button" value="百度" onclick="jump()"> // 或者<button onclick="jump()">百度</button> |