html5有button如何点击按钮跳转网页

html5有button如何点击按钮跳转网页,第1张

1、button外面加a标签

target:_blank新窗口,_self当前窗口

<a href="https://www.baidu.com" target="_blank"><button>Click here</button></a>

2、js

<button onclick="openUrl()">Click here</button>

<script type="text/javascript">

function openUrl() {

var url = 'https://www.baidu.com'

window.open(url) //新窗口打开

window.location.href = url //当前窗口打开

}

</script>

在<button>标签里面写onclick事件:

<button type="submit" id="login-up" onclick="skip()">注册</button>

然后写skip()方法:

function skip()

{

window.location.href="loginup.html"

}

这样就可以啦

这个,我不怎么了解processing是什么东西,但是你可以:

<form action='文件名'>

    <input type='submit' value='按钮文字'>

</form>

或者用button:

<button onclick="tiaozhuan"></button>

<script>

    function tiaozhuan(){

        window.open(文件名)

    }

</script>

可以试试,我也不大确定了、。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/6305176.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-20
下一篇 2023-03-20

发表评论

登录后才能评论

评论列表(0条)

保存