表单怎么根据不同条件提交到不同的页面

本章节介绍一下如何根据不同的情况使表单跳转到不同的页面,下面就通过一个例子做一下简单介绍。

代码实例如下:

<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.softwhy.com/" />
<title>蚂蚁部落</title>
<style type="text/css">
body{
margin:0;
padding:0;
}
ul li{
list-style:none;
}
</style>
<script type="text/javascript">
window.οnlοad=function(){
var antzone=document.getElementById("antzone");
var qq=document.getElementById("qq");
var theform=document.theform;
antzone.οnclick=function(){
theform.action="http://www.softwhy.com";
theform.submit();
}
qq.οnclick=function(){
theform.action="http://www.qq.com";
theform.submit();
}
}
</script>
</head>
<body>
<form action="#" name="theform"/>
<ul>
<li>姓名:<input type="text" value="蚂蚁部落"/></li>
<li>密码:<input type="password" value="123456"/></li>
<li>
<input type="button" id="antzone" value="蚂蚁部落"/>
<input type="button" id="qq" value="腾讯集团"/>
</li>
</ul>
</form>
</body>
</html>

 

 

 

转自  http://www.softwhy.com/article-4320-1.html

如有侵权,请联系删除,谢谢

转载于:https://www.cnblogs.com/linguosen/p/10885499.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值