1. 第一种:使用type=submit  可以直接提交
  1. <html>
  2. <head>
  3. <title>submit直接提交</title>
  4. </head>
  5. <body>
  6. <!-- 表单的提交方式一 -->
  7. <form method="get">
  8. username: <input type="text" name="username"/>
  9. <br/>
  10. password: <input type="password" name="password"/>
  11. <br/>
  12. <input type="submit" value="提交"/>
  13. </form>
  14. </body>
  15. <script type="text/javascript">
  16. </script>
  17. </html>
  1. 第二种:使用type=button提交   需要得到表单的控件 使用表单空间调用自己的submit()方法
  1. <pre name="code" class="html"><html>
  2. <head>
  3. <title>button提交</title>
  4. </head>
  5. <body>
  6. <!-- 表单的提交方式二 -->
  7. <form id="form01" method="get">
  8. username: <input type="text" name="username"/>
  9. <br/>
  10. password: <input type="password" name="password"/>
  11. <br/>
  12. <input type="button" value="提交" onclick="form01();"/>
  13. </form>
  14. </body>
  15. <script type="text/javascript">
  16. //使用button进行表单的提交
  17. function form01() {
  18. //得到form标签
  19. var form01 = document.getElementById("form01");
  20. //提交form表单
  21. form01.submit();
  22. }
  23. </script>
  24. </html>

第三种:直接使用get网址 进行超链接提交


  1. <pre name="code" class="html"><a href="html?username=ccc&password=123456">超链接提交数据</a>

form表单提交三种方式,demo实例详解的更多相关文章

  1. JavaScript表单提交四种方式

    总结JavaScript表单提交四种方式 <!DOCTYPE html> <html> <head> <title>JavaScript表单提交四种方式 ...

  2. form表单提交信息的方式

    form表单提交信息的方法有两种,一种是get,一种是post.get提交的数据是在地址栏上提交,一般隐私数据不会选择这样方式.地址栏上只能提交字符. 如果使用的是post提交,那么信息都在消息正文中 ...

  3. 24.form表单提交的六种方式

    form表单提交方式 1.无刷新页面提交表单 表单可实现无刷新页面提交,无需页面跳转,如下,通过一个隐藏的iframe实现,form表单的target设置为iframe的name名称,form提交目标 ...

  4. form表单提交转为ajax方式提交

    <form action="xxx" method="get"> //action的值是请求的url地址 <div class="f ...

  5. python 获取表单的三种方式

    条件:urls.py文件中配置好url的访问路径.models.py文件中有Business表. 在views.py文件中实现的三种方式: from app01 improt models def b ...

  6. js表单提交一种方式

    在一个html和php混编的文件中,用到js提交表单的方法: 定义表单id为form1,提交按钮type为submit, var data_info = document.getElementById ...

  7. Form表单提交的简要方式

    <html> <head> <meta name="viewport" content="width=device-width" ...

  8. 清空FORM表单的几种方式 Reset 重加载

    1. form中定义name <form name = "sbform" action="sb_add.php" method="post&qu ...

  9. Form表单提交数据的几种方式

    一.submit提交 在form标签中添加Action(提交的地址)和method(post),且有一个submit按钮(<input type='submit'>)就可以进行数据的提交, ...

随机推荐

  1. IE下自定义错误页面不显示的原因

    如果一个 404 页面的内容小于 512B,IE 会认为该 404 页面不够友好,在 IE 下将不会成功返回该 404 错误页面

  2. 25.partial update内置乐观锁并发控制

    主要知识点     (1)partial update内置乐观锁并发控制 (2)retry_on_conflict post /index/type/id/_update?retry_on_confl ...

  3. python类中属性逗号引发的类型改变

    不注意点了个逗号引发了类型改变 [shangbl@newsvn ~]$ cat test.py class AB1: a="a" class AB12: a="a&quo ...

  4. docker 容器操作( 以 tomcat 为例 )

    一.容器操作 一个镜像可以启动多个容器.比如一个 tomcat 镜像,可以启动多个tomcat 容器,启动后的这些 tomcat 都是各自独立的 二.步骤 1.搜索镜像 [root@localhost ...

  5. rabbit-入门

    #启用rabbit的web管理 rabbitmq-plugins.bat enable rabbitmq_management 发布的窗口用TOPIC模式 rabbitmq没有确认消息接收的返回值,M ...

  6. jquery-cookie持久化

    jQuery.Cookie.js,是一个轻量级的Cookie管理插件 <script src="jQuery.1.8.3.js" type="text/javasc ...

  7. [bzoj2466][中山市选2009]树_树形dp

    树  bzoj-2466 中山市选-2009 题目大意:给定一棵树,每一个点有一个按钮和一个灯泡.如果按下一个点的按钮那么和这个点直接相连的点包括这个点的灯泡的状态会改变.如果是点亮就会变成熄灭,如果 ...

  8. HDU 4505

    哈哈哈哈哈哈哈哈哈,省赛,一等奖,一定的一定的一定的一定的... #include <iostream> #include <cstdio> #include <cstr ...

  9. 生成字符Banner

    生成字符Banner http://patorjk.com/software/taag __ _______/ |_ ____ ____ ____ / ___/\ __\/ _ \ / \ / _ \ ...

  10. Aizu/Aoj 0121 Seven Puzzle

    这题应该算是经典的八数码问题的弱化版吧:给你一个4x2的方版,上面有0-7 八个数字,每次只能让编号0的方格跟他的上下左右的方格交换:所以也就是把方格0当做空格看待,每次只有空格周围的方格能够向空格处 ...