{"id":1278,"date":"2025-02-03T18:02:57","date_gmt":"2025-02-03T10:02:57","guid":{"rendered":"https:\/\/www.laixuexila.com\/?p=1278"},"modified":"2025-02-03T18:02:58","modified_gmt":"2025-02-03T10:02:58","slug":"html-%e8%a1%a8%e5%8d%95%e4%b8%8e%e8%be%93%e5%85%a5%e5%85%83%e7%b4%a0%ef%bc%9a%e5%ae%9e%e7%8e%b0%e7%94%a8%e6%88%b7%e4%ba%a4%e4%ba%92","status":"publish","type":"post","link":"https:\/\/www.laixuexila.com\/index.php\/2025\/02\/03\/html-%e8%a1%a8%e5%8d%95%e4%b8%8e%e8%be%93%e5%85%a5%e5%85%83%e7%b4%a0%ef%bc%9a%e5%ae%9e%e7%8e%b0%e7%94%a8%e6%88%b7%e4%ba%a4%e4%ba%92\/","title":{"rendered":"HTML \u8868\u5355\u4e0e\u8f93\u5165\u5143\u7d20\uff1a\u5b9e\u73b0\u7528\u6237\u4ea4\u4e92"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u8868\u5355\u662f\u7f51\u9875\u4e2d\u6536\u96c6\u7528\u6237\u8f93\u5165\u6570\u636e\u7684\u57fa\u672c\u65b9\u5f0f\u3002\u901a\u8fc7\u8868\u5355\u6807\u7b7e <code>&lt;form&gt;<\/code> \u548c\u4e00\u7cfb\u5217\u8f93\u5165\u5143\u7d20\uff08\u5982 <code>&lt;input&gt;<\/code>, <code>&lt;textarea&gt;<\/code>, <code>&lt;select&gt;<\/code> \u7b49\uff09\uff0c\u6211\u4eec\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u4e92\u52a8\u7684\u7528\u6237\u754c\u9762\uff0c\u5141\u8bb8\u7528\u6237\u63d0\u4ea4\u4fe1\u606f\u3002\u638c\u63e1\u5982\u4f55\u4f7f\u7528 HTML \u8868\u5355\u548c\u8f93\u5165\u5143\u7d20\u80fd\u5e2e\u52a9\u4f60\u6784\u5efa\u5177\u6709\u6570\u636e\u6536\u96c6\u3001\u5904\u7406\u548c\u4ea4\u4e92\u529f\u80fd\u7684\u7f51\u9875\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>1. \u8868\u5355\u6807\u7b7e\uff1a<code>&lt;form&gt;<\/code><\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><code>&lt;form&gt;<\/code> \u6807\u7b7e\u7528\u4e8e\u521b\u5efa\u8868\u5355\uff0c\u5e76\u5305\u542b\u7528\u6237\u8f93\u5165\u7684\u6240\u6709\u5b57\u6bb5\u3002\u8868\u5355\u901a\u8fc7 <code>action<\/code> \u548c <code>method<\/code> \u5c5e\u6027\u6307\u5b9a\u6570\u636e\u63d0\u4ea4\u7684\u76ee\u6807\u548c\u65b9\u6cd5\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u793a\u4f8b<\/strong>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;form action=\"\/submit\" method=\"POST\"&gt;\n    &lt;!-- \u8f93\u5165\u5b57\u6bb5\u5c06\u5728\u8fd9\u91cc --&gt;\n&lt;\/form&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>action<\/code><\/strong>\uff1a\u6307\u5b9a\u6570\u636e\u63d0\u4ea4\u7684\u670d\u52a1\u5668\u7aef\u5730\u5740\u3002\u53ef\u4ee5\u662f\u4e00\u4e2a URL\uff0c\u8868\u793a\u8868\u5355\u6570\u636e\u63d0\u4ea4\u7684\u76ee\u6807\u3002<\/li>\n\n\n\n<li><strong><code>method<\/code><\/strong>\uff1a\u6307\u5b9a\u8868\u5355\u63d0\u4ea4\u7684 HTTP \u65b9\u6cd5\uff0c\u5e38\u7528\u7684\u6709 <code>GET<\/code> \u548c <code>POST<\/code>\uff1a<\/li>\n\n\n\n<li><strong><code>GET<\/code><\/strong>\uff1a\u5c06\u8868\u5355\u6570\u636e\u9644\u52a0\u5728 URL \u540e\u63d0\u4ea4\uff0c\u9002\u7528\u4e8e\u83b7\u53d6\u6570\u636e\u3002<\/li>\n\n\n\n<li><strong><code>POST<\/code><\/strong>\uff1a\u5c06\u8868\u5355\u6570\u636e\u4f5c\u4e3a\u8bf7\u6c42\u7684\u4e3b\u4f53\u53d1\u9001\uff0c\u9002\u7528\u4e8e\u63d0\u4ea4\u654f\u611f\u6570\u636e\u6216\u5927\u6570\u636e\u91cf\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>2. \u8f93\u5165\u5143\u7d20\uff1a<code>&lt;input&gt;<\/code>, <code>&lt;textarea&gt;<\/code>, <code>&lt;select&gt;<\/code>, <code>&lt;option&gt;<\/code>, <code>&lt;button&gt;<\/code><\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">HTML \u63d0\u4f9b\u4e86\u591a\u79cd\u8f93\u5165\u5143\u7d20\uff0c\u7528\u4e8e\u4e0d\u540c\u7c7b\u578b\u7684\u6570\u636e\u6536\u96c6\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>&lt;input><\/code><\/strong>\uff1a\u6700\u5e38\u7528\u7684\u8f93\u5165\u5143\u7d20\uff0c\u652f\u6301\u591a\u79cd\u7c7b\u578b\uff08\u5982\u6587\u672c\u6846\u3001\u5bc6\u7801\u6846\u3001\u5355\u9009\u6846\u7b49\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;input type=\"text\" name=\"username\"&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>&lt;textarea><\/code><\/strong>\uff1a\u7528\u4e8e\u591a\u884c\u6587\u672c\u8f93\u5165\uff0c\u5e38\u7528\u4e8e\u8bc4\u8bba\u6216\u7559\u8a00\u6846\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;textarea name=\"comments\"&gt;&lt;\/textarea&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>&lt;select><\/code><\/strong>\uff1a\u4e0b\u62c9\u5217\u8868\u6846\uff0c\u5141\u8bb8\u7528\u6237\u4ece\u591a\u4e2a\u9009\u9879\u4e2d\u9009\u62e9\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;select name=\"city\"&gt;\n    &lt;option value=\"beijing\"&gt;\u5317\u4eac&lt;\/option&gt;\n    &lt;option value=\"shanghai\"&gt;\u4e0a\u6d77&lt;\/option&gt;\n    &lt;option value=\"guangzhou\"&gt;\u5e7f\u5dde&lt;\/option&gt;\n&lt;\/select&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>&lt;option><\/code><\/strong>\uff1a\u5728 <code>&lt;select><\/code> \u4e2d\u5b9a\u4e49\u5355\u4e2a\u9009\u9879\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;option value=\"beijing\"&gt;\u5317\u4eac&lt;\/option&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>&lt;button><\/code><\/strong>\uff1a\u6309\u94ae\u5143\u7d20\uff0c\u901a\u5e38\u7528\u4e8e\u89e6\u53d1\u8868\u5355\u63d0\u4ea4\u6216\u6267\u884c\u67d0\u4e9b\u52a8\u4f5c\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;button type=\"submit\"&gt;\u63d0\u4ea4&lt;\/button&gt;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>3. \u8f93\u5165\u7c7b\u578b\uff1a<code>text<\/code>, <code>password<\/code>, <code>radio<\/code>, <code>checkbox<\/code>, <code>date<\/code>, <code>email<\/code><\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><code>&lt;input&gt;<\/code> \u5143\u7d20\u901a\u8fc7 <code>type<\/code> \u5c5e\u6027\u6765\u6307\u5b9a\u8f93\u5165\u5b57\u6bb5\u7684\u7c7b\u578b\uff0c\u5e38\u89c1\u7684\u8f93\u5165\u7c7b\u578b\u5305\u62ec\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>type=\"text\"<\/code><\/strong>\uff1a\u666e\u901a\u6587\u672c\u8f93\u5165\u6846\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;input type=\"text\" name=\"username\"&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>type=\"password\"<\/code><\/strong>\uff1a\u5bc6\u7801\u8f93\u5165\u6846\uff0c\u8f93\u5165\u7684\u5185\u5bb9\u4f1a\u4ee5\u661f\u53f7\u6216\u5706\u70b9\u663e\u793a\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;input type=\"password\" name=\"password\"&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>type=\"radio\"<\/code><\/strong>\uff1a\u5355\u9009\u6846\uff0c\u5141\u8bb8\u7528\u6237\u5728\u591a\u4e2a\u9009\u9879\u4e2d\u9009\u62e9\u4e00\u4e2a\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;input type=\"radio\" name=\"gender\" value=\"male\"&gt; \u7537\n&lt;input type=\"radio\" name=\"gender\" value=\"female\"&gt; \u5973<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>type=\"checkbox\"<\/code><\/strong>\uff1a\u590d\u9009\u6846\uff0c\u5141\u8bb8\u7528\u6237\u5728\u591a\u4e2a\u9009\u9879\u4e2d\u9009\u62e9\u591a\u4e2a\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;input type=\"checkbox\" name=\"interests\" value=\"music\"&gt; \u97f3\u4e50\n&lt;input type=\"checkbox\" name=\"interests\" value=\"sports\"&gt; \u4f53\u80b2<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>type=\"date\"<\/code><\/strong>\uff1a\u65e5\u671f\u8f93\u5165\u6846\uff0c\u5141\u8bb8\u7528\u6237\u9009\u62e9\u65e5\u671f\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;input type=\"date\" name=\"dob\"&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>type=\"email\"<\/code><\/strong>\uff1a\u7535\u5b50\u90ae\u4ef6\u8f93\u5165\u6846\uff0c\u6d4f\u89c8\u5668\u4f1a\u9a8c\u8bc1\u7528\u6237\u8f93\u5165\u662f\u5426\u7b26\u5408\u7535\u5b50\u90ae\u4ef6\u683c\u5f0f\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;input type=\"email\" name=\"email\"&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u4f5c\u7528<\/strong>\uff1a\u4e0d\u540c\u7c7b\u578b\u7684\u8f93\u5165\u5b57\u6bb5\u5e2e\u52a9\u6839\u636e\u6570\u636e\u7684\u9700\u6c42\u63d0\u4f9b\u4e0d\u540c\u7684\u8f93\u5165\u65b9\u5f0f\u3002\u901a\u8fc7\u5408\u7406\u9009\u62e9\u8f93\u5165\u7c7b\u578b\uff0c\u53ef\u4ee5\u63d0\u9ad8\u7528\u6237\u4f53\u9a8c\u548c\u8868\u5355\u9a8c\u8bc1\u7684\u51c6\u786e\u6027\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>4. \u8868\u5355\u7684 <code>action<\/code> \u548c <code>method<\/code> \u5c5e\u6027<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>action<\/code><\/strong>\uff1a\u6307\u5b9a\u8868\u5355\u6570\u636e\u63d0\u4ea4\u7684\u76ee\u6807 URL\u3002\u4f8b\u5982\uff0c\u5f53\u8868\u5355\u63d0\u4ea4\u65f6\uff0c\u6570\u636e\u4f1a\u53d1\u9001\u5230 <code>\/submit<\/code> \u9875\u9762\u8fdb\u884c\u5904\u7406\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;form action=\"\/submit\" method=\"POST\"&gt;\n    &lt;!-- \u8868\u5355\u5185\u5bb9 --&gt;\n&lt;\/form&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>method<\/code><\/strong>\uff1a\u6307\u5b9a\u8868\u5355\u63d0\u4ea4\u6570\u636e\u7684\u65b9\u5f0f\u3002\u5e38\u7528\u7684\u6709 <code>GET<\/code> \u548c <code>POST<\/code>\uff1a<\/li>\n\n\n\n<li><strong><code>GET<\/code><\/strong>\uff1a\u9002\u5408\u7528\u6765\u83b7\u53d6\u6570\u636e\uff0c\u8868\u5355\u6570\u636e\u4f1a\u9644\u52a0\u5728 URL \u540e\u3002\u9002\u7528\u4e8e\u67e5\u8be2\u6216\u8fc7\u6ee4\u3002<\/li>\n\n\n\n<li><strong><code>POST<\/code><\/strong>\uff1a\u9002\u5408\u7528\u6765\u63d0\u4ea4\u6570\u636e\uff0c\u8868\u5355\u6570\u636e\u4f5c\u4e3a\u8bf7\u6c42\u4f53\u53d1\u9001\uff0c\u9002\u7528\u4e8e\u4f20\u8f93\u654f\u611f\u6570\u636e\u6216\u5927\u6570\u636e\u91cf\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;form action=\"\/submit\" method=\"POST\"&gt;\n    &lt;input type=\"text\" name=\"name\"&gt;\n    &lt;input type=\"submit\" value=\"\u63d0\u4ea4\"&gt;\n&lt;\/form&gt;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>5. \u63d0\u4ea4\u6309\u94ae\uff1a<code>&lt;input type=\"submit\"&gt;<\/code>, <code>&lt;button&gt;<\/code><\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u8868\u5355\u63d0\u4ea4\u901a\u5e38\u901a\u8fc7\u70b9\u51fb\u63d0\u4ea4\u6309\u94ae\u6765\u89e6\u53d1\u3002HTML \u63d0\u4f9b\u4e86\u4e24\u79cd\u5e38\u89c1\u7684\u63d0\u4ea4\u6309\u94ae\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>&lt;input type=\"submit\"><\/code><\/strong>\uff1a\u63d0\u4ea4\u6309\u94ae\uff0c\u70b9\u51fb\u540e\u8868\u5355\u4f1a\u88ab\u63d0\u4ea4\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;input type=\"submit\" value=\"\u63d0\u4ea4\"&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>&lt;button><\/code><\/strong>\uff1a\u6309\u94ae\u5143\u7d20\uff0c\u4e5f\u53ef\u4f5c\u4e3a\u63d0\u4ea4\u6309\u94ae\u4f7f\u7528\uff0c\u901a\u5e38\u5177\u6709\u66f4\u591a\u81ea\u5b9a\u4e49\u529f\u80fd\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;button type=\"submit\"&gt;\u63d0\u4ea4&lt;\/button&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u4f5c\u7528<\/strong>\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>&lt;input type=\"submit\"><\/code> \u548c <code>&lt;button><\/code> \u90fd\u662f\u8868\u5355\u63d0\u4ea4\u7684\u89e6\u53d1\u5668\u3002\u5728\u591a\u6570\u60c5\u51b5\u4e0b\uff0c\u4f7f\u7528 <code>&lt;button><\/code> \u53ef\u4ee5\u63d0\u4f9b\u66f4\u591a\u7684\u6837\u5f0f\u548c\u529f\u80fd\u81ea\u5b9a\u4e49\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u603b\u7ed3<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u8868\u5355\u548c\u8f93\u5165\u5143\u7d20\u662f\u521b\u5efa\u7528\u6237\u4ea4\u4e92\u754c\u9762\u4e0d\u53ef\u6216\u7f3a\u7684\u90e8\u5206\u3002\u901a\u8fc7\u4f7f\u7528 <code>&lt;form&gt;<\/code>\u3001<code>&lt;input&gt;<\/code>\u3001<code>&lt;textarea&gt;<\/code>\u3001<code>&lt;select&gt;<\/code> \u7b49\u6807\u7b7e\uff0c\u4f60\u53ef\u4ee5\u6536\u96c6\u7528\u6237\u8f93\u5165\u7684\u6570\u636e\u5e76\u8fdb\u884c\u63d0\u4ea4\u3002\u4e0d\u540c\u7684\u8f93\u5165\u7c7b\u578b\uff08\u5982 <code>text<\/code>\u3001<code>password<\/code>\u3001<code>radio<\/code> \u7b49\uff09\u5e2e\u52a9\u7528\u6237\u6839\u636e\u9700\u6c42\u9009\u62e9\u4e0d\u540c\u7684\u8f93\u5165\u65b9\u5f0f\uff0c\u63d0\u5347\u7528\u6237\u4f53\u9a8c\u3002\u5408\u7406\u4f7f\u7528 <code>action<\/code> \u548c <code>method<\/code> \u5c5e\u6027\u53ef\u4ee5\u786e\u4fdd\u8868\u5355\u6570\u636e\u6b63\u786e\u5730\u63d0\u4ea4\u5230\u670d\u52a1\u5668\u7aef\u8fdb\u884c\u5904\u7406\u3002\u638c\u63e1\u8868\u5355\u548c\u8f93\u5165\u5143\u7d20\u7684\u7528\u6cd5\uff0c\u4f60\u53ef\u4ee5\u521b\u5efa\u529f\u80fd\u4e30\u5bcc\u3001\u7528\u6237\u53cb\u597d\u7684\u7f51\u9875\u8868\u5355\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8868\u5355\u662f\u7f51\u9875\u4e2d\u6536\u96c6\u7528\u6237\u8f93\u5165\u6570\u636e\u7684\u57fa\u672c\u65b9\u5f0f\u3002\u901a\u8fc7\u8868\u5355\u6807\u7b7e &lt;form&gt; \u548c\u4e00\u7cfb\u5217\u8f93\u5165\u5143\u7d20\uff08\u5982 &lt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[56],"tags":[],"class_list":["post-1278","post","type-post","status-publish","format-standard","hentry","category-html"],"_links":{"self":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/comments?post=1278"}],"version-history":[{"count":2,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1278\/revisions"}],"predecessor-version":[{"id":1299,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1278\/revisions\/1299"}],"wp:attachment":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/media?parent=1278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/categories?post=1278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/tags?post=1278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}