html里button实现跳转事件
1、<
button
onclick
=
"window.location.href = 'https://www.baidu.com/'"
>百度</
button
>
2、在button外面套一层<a></a>
<
button
>百度</
button
>
</
a
>
3、用js写
<
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
>