Blogger Information
Blog 25
fans 1
comment 0
visits 12958
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
表单以及简单的后台页面
xueblog9的进阶之旅
Original
365 people have browsed it

表单以及简单的后台页面

源码

  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>表单</title>
  8. </head>
  9. <body>
  10. <h3>用户快速注册</h3>
  11. <form action="check.php" method="post">
  12. <div>
  13. <label for="uname">登陆名:</label>
  14. <br>
  15. <input type="text" id="uname" name="username" placeholder="登陆名不能为空">
  16. </div>
  17. <div>
  18. <label for="psw">密码:</label>
  19. <br>
  20. <input type="password" id="psw" name="password" placeholder="密码不空">
  21. <button onclick="showPassword(this,this.from.Password)">看密码1</button>
  22. </div>
  23. <div>
  24. <label for="psw">确认密码:</label>
  25. <br>
  26. <input type="password" id="psw" name="password" placeholder="密码不空">
  27. <button onclick="showPassword(this,this.from.Password)">看密码2</button>
  28. </div>
  29. <br>
  30. <div>
  31. <label for="3ge">你有几个兄弟姐妹:</label>
  32. <input type="radio" id="1ge" name="bbb" value="1ge"><label for="1ge">1个</label>
  33. <input type="radio" id="2ge" name="bbb" value="2ge"><label for="1ge">2个</label>
  34. <input type="radio" id="3ge" name="bbb" value="3ge" checked><label for="1ge">3个</label>
  35. </div>
  36. <br>
  37. <div>
  38. <label for="ls">你的兄弟姐妹叫什么名字:</label>
  39. <input type="checkbox" id="zs" name="name[]" value="zs"><label for="zs">张三</label>
  40. <input type="checkbox" id="ls" name="name[]" value="ls"><label for="ls">李四</label>
  41. <input type="checkbox" id="ww" name="name[]" value="ww" checked><label for="ww">王五</label>
  42. </div>
  43. <br>
  44. <div>
  45. <label for="">兄弟姐妹中最高的学历:</label>
  46. <select name="edu" id="">
  47. <option value="0" selected disabled>--请选择--</option>
  48. <option value="1">研究生</option>
  49. <option value="2">博士</option>
  50. <option value="3">博士后</option>
  51. </select>
  52. </div>
  53. <div>
  54. <button>提交</button>
  55. </div>
  56. </form>
  57. <br>
  58. <br>
  59. <div class="header">
  60. <h3>简单的小后台</h3>
  61. <div>
  62. <b><em>root</em></b>
  63. <a href="logout.php">退出</a>
  64. </div>
  65. </div>
  66. <ol class="nav">
  67. <li><a href="../0705/demo1.html" target="area">页面1</a></li>
  68. <li><a href="../0705/demo2.html" target="area">页面2</a></li>
  69. <li><a href="../0705/demo3.html" target="area">页面3</a></li>
  70. <li><a href="../0705/test.mp4" target="area">页面4</a></li>
  71. </ol>
  72. <iframe srcdoc="<b><em><a href='javascript:;'>请点击页面菜单</a></em></b>" frameborder="1" name="area" width="500px" height="400px"></iframe>
  73. </body>
  74. </html>

效果图


总结

1. 发送的数据:

1.1 自定义(最灵活):用户自己输入,input的type为text,文本框/文本域,用户登录注册

1.2 预定义(最安全):由程序员/开发者已经写好,用户做选择,复选框/单选框/下拉菜单类似选择题

1.3 用户提交的方式:form标签的预置属性action=”xxx.php”,向服务器中xxx.php文件提交,method决定了提交方式

  • 1.3.1 method=”get”时,通过url提交,体现在网页跳转地址中
  • 1.3.2 method=”post”时,直接提交到服务器,可以在载荷中检查到,应该是对接接口的
  • 1.3.3 onsubmit=”return false”: 将表单的默认提交行为禁用

    1.4 <label>标签预置属性for用于绑定input中的id,页面中存在绑定关系,input中的type类型决定了什么类型的表单;

  • 1.4.1 单行文本框input的type类型为”text”,”password”等
  • 1.4.2 单选按钮input的type类型为”radio”
  • 1.4.3 复选框input的type类型为”checkbox”
  • 1.4.4 下拉列表用select标签(变量名name在此),下拉选项option(变量值value在此),selected disabled:表示默认首选但不可用,用来提示用户作用

    1.5 <button>标签默认提交,<button>=<button type="submit">

    1.6 多媒体标签<video>,<audio>

  • 1.6.1 controls:显示播放控件,布尔属性
  • 1.6.2 autoplay:自动播放
  • 1.6.3 poster:链接封面图片

    1.7 内联框架标签<iframe>-画中画

  • 1.7.1 <a>标签中target指向与iframe的变量名一直,即完成绑定
  • 1.7.2 a标签链接指定在iframe定义的区域中打开
Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post