代码描述:JavaScript让form表单 根据不同条件 提交不同页面。JavaScript让form表单根据不同条件提交到不同页面源码下载
本章节介绍一下如何根据不同的情况使表单跳转到不同的页面,下面就通过一个例子做一下简单介绍。 代码实例如下:
<!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="https://www.51qianduan.com/" /> <title>51前端</title> <style type="text/css"> body{ margin:0; padding:0; } ul li{ list-style:none; } </style> <script type="text/javascript"> window.onload=function(){ var antzone=document.getElementById("antzone"); var qq=document.getElementById("qq"); var theform=document.theform; antzone.onclick=function(){ theform.action="http://www.softwhy.com"; theform.submit(); } qq.onclick=function(){ theform.action="http://www.qq.com"; theform.submit(); } } </script> </head> <body> <form action="#" name="theform"/> <ul> <li>姓名:<input type="text" value="51前端"/></li> <li>密码:<input type="password" value="123456"/></li> <li> <input type="button" id="antzone" value="51前端"/> <input type="button" id="qq" value="腾讯集团"/> </li> </ul> </form> </body> </html>
请绑定手机号,在继续操作
注意:只有绑定手机以后,才可使用网站全部功能