学习笔记——表单提交数据

1.button提交

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title> new document </title>
  <meta name="generator" content="editplus" />
  <meta name="author" content="" />
  <meta name="keywords" content="" />
  <meta name="description" content="" />
 <style type="text/css">
</style>
 </head>

 <body>
  <form id="form1">
  <input type="text" name="username">
  <br>
  <input type="button" value="tijiao" onclick="form1();">
  </form>
 </body>
 <script type="text/javascript">
 function form1(){
 //获取form
 var form1=document.getElementById("form1");
 form1.action="1.html";
form1.submit(); 
 }
 </script>
</html>

这次居然把javascript写成script,然后瞬间懵逼了......下次注意;提交以后,会在网址url中显示

file:///C:/Users/zk/1.html?username=sdasd

2.使用超链接提供

只需写<a href="1.html?username=assdas">使用超链接提交也可以达到效果</a>

posted on 2016-03-23 22:37  ShamSilence  阅读(144)  评论(0编辑  收藏  举报

导航