您的位置:首页 > Web前端 > JavaScript

按钮js跳转到非表单提交页

2016-01-18 10:35 465 查看
<!DOCTYPE html>

<html>

<head>

<meta
charset="UTF-8">

<title></title>

</head>

<body>

<form
action="http://baidu.com"
method="post">

<input
type="button"
value="跳转到必应"
onclick="jumpto()"/>

<input
type="submit"
value="测试是否能提交表单"
/>

</form>

 

<script>

function jumpto(){

alert('我开始跳了啊?');

window.location.href="http://cn.bing.com/";

}

</script>

</body>

</html>

 

 

PS: 临时给同事写的,其实我给它的建议是写个<a>标签,然后将样式搞得跟button一样,这个比较好.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: