{"id":12237,"date":"2026-06-22T21:39:35","date_gmt":"2026-06-22T13:39:35","guid":{"rendered":"https:\/\/www.zhangxinxu.com\/wordpress\/?p=12237"},"modified":"2026-06-22T21:39:35","modified_gmt":"2026-06-22T13:39:35","slug":"html-common-toggle-beforetoggle-event","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2026\/06\/html-common-toggle-beforetoggle-event\/","title":{"rendered":"\u5168\u662f\u597d\u4e1c\u897f\uff01HTML command\u5c5e\u6027\u548cJS toggle\u4e8b\u4ef6"},"content":{"rendered":"<p>by <a href=\"https:\/\/www.zhangxinxu.com\/\">zhangxinxu<\/a> from <a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=12237\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=12237<\/a><br \/>\n\u672c\u6587\u53ef\u5168\u6587\u8f6c\u8f7d\uff0c\u4f46\u9700\u8981\u4fdd\u7559\u539f\u4f5c\u8005\u3001\u51fa\u5904\u4ee5\u53ca\u6587\u4e2d\u94fe\u63a5\uff0cAI\u6293\u53d6\u4fdd\u7559\u539f\u6587\u5730\u5740\uff0c\u4efb\u4f55\u7f51\u7ad9\u5747\u53ef\u6458\u8981\u805a\u5408\uff0c\u5546\u7528\u8bf7\u8054\u7cfb\u6388\u6743\u3002<\/p>\n<h3>\u4e00\u3001\u5148\u8bf4command\u5c5e\u6027<\/h3>\n<p>HTML <code>command<\/code>\u5c5e\u6027\u53ea\u80fd\u8bbe\u7f6e\u5728\u6309\u94ae\u5143\u7d20\u4e0a\uff0c\u53ef\u4ee5\u89e6\u53d1\u5143\u7d20\u5185\u7f6e\u7684\u65b9\u6cd5\uff0c\u800c\u8fd9\u4e2a\u65b9\u6cd5\u662f\u53ef\u4ee5\u81ea\u5b9a\u4e49\u8bbe\u7f6e\u7684\u3002<\/p>\n<p>\u6bd4\u65b9\u8bf4\u4e0b\u9762\u8fd9\u4e2a\u70b9\u51fb\u6309\u94ae\u663e\u793a\u5f39\u6846\u7684\u5b9e\u73b0\uff1a<\/p>\n<pre>&lt;button commandfor=\"my-dialog\" command=\"show-modal\"&gt;\r\n  \u70b9\u51fb\u663e\u793a\u5f39\u6846\r\n&lt;\/button&gt;\r\n\r\n&lt;dialog id=\"my-dialog\" closedby=\"any\"&gt;\r\n  \u6211\u663e\u793a\u5566\uff01\r\n&lt;\/dialog&gt;<\/pre>\n<p><code>&lt;dialog&gt;<\/code>\u5f39\u6846\u5143\u7d20\u5185\u7f6e\u4e86<code>showModal<\/code>\u65b9\u6cd5\uff0c\u6b64\u65f6\uff0c\u70b9\u51fb\u6309\u94ae\uff0c\u5f39\u6846\u5c31\u4f1a\u663e\u793a\u3002<\/p>\n<p>\u5b9e\u65f6\u6e32\u67d3\u6548\u679c\u5982\u4e0b\uff1a<\/p>\n<p><button commandfor=\"my-dialog\" command=\"show-modal\">\u70b9\u51fb\u663e\u793a\u5f39\u6846<\/button><\/p>\n<p><dialog id=\"my-dialog\" closedby=\"any\">\u6211\u663e\u793a\u5566\uff01<\/dialog><\/p>\n<p><code>commandfor<\/code>\u8fd8\u9002\u5408\u89e6\u53d1popover\u6d6e\u5c42\u7684\u663e\u793a\uff0c\u867d\u7136<code>popover<\/code>\u5c5e\u6027\u6709\u539f\u751f\u7684<code>popovertaregt<\/code>\u5c5e\u6027\u3002<\/p>\n<h4>\u5b9e\u73b0\u539f\u7406<\/h4>\n<p><code>commandfor<\/code>\u5c5e\u6027\u6267\u884c\u76ee\u6807\u5143\u7d20\uff0c\u901a\u8fc7ID\u5c5e\u6027\u503c\u5173\u8054\u3002<\/p>\n<p><code>command<\/code>\u5c5e\u6027\u4f1a\u8c03\u7528\u76ee\u6807\u5143\u7d20\u4e0a\u7684DOM\u65b9\u6cd5\uff0c\u5982\u679cDOM\u65b9\u6cd5\u662f\u9a7c\u5cf0\u683c\u5f0f\uff0c\u5219\u4f7f\u7528\u77ed\u6a2a\u7ebf\u8868\u793a\u3002<\/p>\n<h4>\u662f\u5426\u652f\u6301\u81ea\u5b9a\u4e49\u65b9\u6cd5<\/h4>\n<p>\u6d4b\u8bd5\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre>&lt;button commandfor=\"hanyun\" command=\"radius\"&gt;\r\n  \u70b9\u51fb\u56fe\u7247\u5706\u89d2\r\n&lt;\/button&gt;\r\n  \r\n&lt;img id=\"hanyun\" src=\"hanyun.jpg\" alt=\"\u5f20\u542b\u97f5\"&gt;\r\n  \r\n&lt;script&gt;\r\nHTMLImageElement.prototype.radius = function () {\r\n  this.style.borderRadius = '50%';\r\n} \r\n&lt;\/script&gt;<\/pre>\n<p>\u7ed3\u679c\u70b9\u51fb\u6309\u94ae\u662f\u65e0\u6548\u7684\uff0c\u5b9e\u65f6\u6e32\u67d3\u5982\u4e0b\uff0c\u70b9\u51fb\u662f\u6ca1\u6709\u4efb\u4f55\u53cd\u5e94\u7684\u3002<\/p>\n<div style=\"border:1px solid #ddd; padding: 1rem;background:#f3f5f7;\">\n<button commandfor=\"hanyun\" command=\"--radius\">\u70b9\u51fb\u56fe\u7247\u5706\u89d2<\/button><\/p>\n<p><img decoding=\"async\" id=\"hanyun\" src=\"https:\/\/image.zhangxinxu.com\/image\/study\/s\/hanyun.jpg\" alt=\"\u5f20\u542b\u97f5\" width=\"256\"><\/div>\n<h4>\u6b63\u786e\u4f7f\u7528\u81ea\u5b9a\u4e49\u65b9\u6cd5\u7684\u8def\u5f84<\/h4>\n<p><code>command<\/code>\u6267\u884c\u5176\u5b9e\u662f\u652f\u6301\u81ea\u5b9a\u4e49\u884c\u4e3a\u7684\uff0c\u53ea\u662f\u4f7f\u7528\u65b9\u6cd5\u5e76\u4e0d\u662f\u4e0a\u9762\u6240\u8bf4\u7684\u8fd9\u6837\uff0c\u800c\u662f\u4f7f\u7528 <code>command<\/code> \u4e8b\u4ef6\u3002<\/p>\n<p>\u4ee3\u7801\u793a\u610f\uff1a<\/p>\n<pre>&lt;button commandfor=\"image\" command=\"--radius\"&gt;\r\n  \u70b9\u51fb\u56fe\u7247\u5706\u89d2\r\n&lt;\/button&gt;\r\n  \r\n&lt;img id=\"image\" src=\"hanyun.jpg\"&gt;\r\n  \r\n&lt;script&gt;\r\nimage.addEventListener(\"command\", (event) =&gt; {\r\n  if (event.command === \"--radius\") {\r\n    event.target.style.borderRadius = '50%';\r\n  }\r\n});\r\n&lt;\/script&gt;<\/pre>\n<p>\u6b64\u65f6\uff0c\u70b9\u51fb\u6309\u94ae\uff0c\u5c31\u53ef\u4ee5\u770b\u5230\u56fe\u7247\u5143\u7d20\u5706\u89d2\u5316\u4e86\u3002<\/p>\n<p>\u5b9e\u65f6\u6e32\u67d3\u6548\u679c\u5982\u4e0b\uff08RSS\u8ba2\u9605\u5668\u4e2d\u65e0\u6548\u679c\uff0c\u53ef\u8bbf\u95ee\u539f\u6587\u4f53\u9a8c\uff09\uff1a<\/p>\n<div style=\"border:1px solid #ddd; padding: 1rem;background:#f3f5f7;\">\n<button commandfor=\"image\" command=\"--radius\">\u70b9\u51fb\u56fe\u7247\u5706\u89d2<\/button><\/p>\n<p><img decoding=\"async\" id=\"image\" src=\"https:\/\/image.zhangxinxu.com\/image\/study\/s\/hanyun.jpg\" alt=\"\" width=\"256\">\n<\/div>\n<p><script>\nimage.addEventListener(\"command\", (event) => {\n  if (event.command === \"--radius\") {\n    event.target.style.borderRadius = '50%';\n  }\n});\n<\/script><\/p>\n<h4>\u517c\u5bb9\u6027<\/h4>\n<p>\u51fa\u4e4e\u6211\u7684\u610f\u6599\uff0c<code>commandfor<\/code>\u5c5e\u6027\u4e3b\u6d41\u6d4f\u89c8\u5668\u5c45\u7136\u90fd\u5df2\u7ecf\u652f\u6301\u4e86\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202606\/2026-6-22_171942.png\" width=\"572\" height=\"389\" alt=\"commond\u5c5e\u6027\u517c\u5bb9\u6027\" class=\"alignnone size-medium\" \/><\/p>\n<h3>\u4e8c\u3001\u518d\u6765\u8bf4\u8bf4toggle\u4e8b\u4ef6<\/h3>\n<p>ToggleEvent\u4e8b\u4ef6\u7c7b\u578b\u4e5f\u662f\u4e00\u4e2a\u65b0\u7279\u6027\uff0c\u51fa\u73b0\u7684\u65f6\u673a\u6bd4\u4e0a\u9762\u7684<code>command<\/code>\u5c5e\u6027\u8981\u65e9\uff0c\u5982\u4e0b\u622a\u56fe\u6240\u793a\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202606\/2026-6-22_172818.png\" width=\"650\" height=\"229\" alt=\"Toggle\u4e8b\u4ef6\u7684\u517c\u5bb9\u6027\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u6b64\u4e8b\u4ef6\u5bf9\u8c61\u5305\u62ec <code>beforetoggle<\/code> \u548c <code>toggle<\/code> \u4e24\u79cd\u4e8b\u4ef6\u7c7b\u578b\u3002<\/p>\n<p>\u5176\u4e2d\uff1a<\/p>\n<ul>\n<li><code>beforetoggle<\/code>\u4e8b\u4ef6\u4f1a\u5728Popover\u5f39\u51fa\u6846\u6216<code>&lt;dialog&gt;<\/code>\u5143\u7d20\u663e\u793a\u6216\u9690\u85cf\u4e4b\u524d\u89e6\u53d1\uff1b<\/li>\n<li><code>toggle<\/code> \u4e8b\u4ef6\u5219\u4f1a\u5728Popover\u5f39\u51fa\u6846\u3001<code>&lt;dialog&gt;<\/code>\u5143\u7d20\u6216\u8005<code>&lt;details&gt;<\/code>\u5143\u7d20\u663e\u793a\u6216\u9690\u85cf\u540e\u89e6\u53d1\uff0c\u591a\u4e86\u4e2a<code>&lt;details&gt;<\/code>\u5143\u7d20\u3002<\/li>\n<\/ul>\n<h4>newState\u548coldState\u503c<\/h4>\n<p>\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7<code>newState<\/code>\u548c<code>oldState<\/code>\u4e8b\u4ef6\u5bf9\u8c61\u7684\u5c5e\u6027\u5224\u65ad\u5f53\u524d\u5143\u7d20\u7684\u5c55\u5f00\u8fd8\u662f\u6536\u8d77\u72b6\u6001\u3002<\/p>\n<p>\u6bd4\u65b9\u8bf4\u5982\u4e0b\u6240\u793a\u7684\u5b9e\u65f6\u6e32\u67d3\u6d4b\u8bd5\u6848\u4f8b\uff08RSS\u9605\u8bfb\u5668\u4e2d\u65e0\u6548\u679c\uff0c\u53ef\u4ee5\u8bbf\u95ee\u539f\u6587\u4f53\u9a8c\uff09\uff1a<\/p>\n<div style=\"border:1px solid #ddd; padding: 1rem;\">\n<details id=\"details\" open>\n<summary>HTML\u5e76\u4e0d\u7b80\u5355<\/summary>\n<p>    <content>\u6280\u672f\u53d1\u5c55\u8fd8\u662f\u5f88\u5feb\u7684\uff0c\u5728\u300aHTML\u5e76\u4e0d\u7b80\u5355\u300b\u8fd9\u672c\u4e66\u91cc\u4ecb\u7ecd details \u5143\u7d20\u7684\u65f6\u5019\uff0c\u8fd8\u6ca1\u6709 toggle \u4e8b\u4ef6\u5462\u3002<\/content><br \/>\n<\/details>\n<\/div>\n<p><script>\n  details.addEventListener(\"toggle\", function (event) {\n    if (event.newState === \"open\") {\n      this.style.background = 'aliceblue';\n    } else {\n      this.style.background = '';\n    }\n  });\n<\/script><\/p>\n<p>\u6d4b\u8bd5\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre>&lt;details id=\"details\" open&gt;\r\n    &lt;summary&gt;HTML\u5e76\u4e0d\u7b80\u5355&lt;\/summary&gt;\r\n    &lt;content&gt;\u6280\u672f\u53d1\u5c55\u8fd8\u662f\u5f88\u5feb\u7684\uff0c\u5728\u300aHTML\u5e76\u4e0d\u7b80\u5355\u300b\u8fd9\u672c\u4e66\u91cc\u4ecb\u7ecd details \u5143\u7d20\u7684\u65f6\u5019\uff0c\u8fd8\u6ca1\u6709 toggle \u4e8b\u4ef6\u5462\u3002&lt;\/content&gt;\r\n&lt;\/details&gt;\r\n&lt;script&gt;\r\n  details.addEventListener(\"toggle\", function (event) {\r\n    if (event.newState === \"open\") {\r\n      this.style.background = 'aliceblue';\r\n    } else {\r\n      this.style.background = '';\r\n    }\r\n  });\r\n&lt;\/script&gt;<\/pre>\n<h4>\u6700\u8fd1\u521a\u652f\u6301\u7684event.source<\/h4>\n<p><code>event.source<\/code>\u53ef\u4ee5\u8fd4\u56de\u89e6\u53d1ToggleEvent\u4e8b\u4ef6\u6267\u884c\u7684\u76ee\u6807\u5143\u7d20\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u4e00\u4e2a<code>&lt;dialog&gt;<\/code>\u5143\u7d20\u5173\u95ed\u65e2\u53ef\u4ee5\u4f7f\u7528\u5185\u7f6e\u7684\u5173\u95ed\u884c\u4e3a\uff08\u4f8b\u5982ESC\uff0c\u70b9\u51fb\u9ed1\u8272\u8499\u5c42\uff0cForm\u5173\u95ed\u3001command\u5173\u95ed\uff09\uff0c\u8fd8\u53ef\u4ee5\u624b\u52a8\u8c03\u7528<code>close()<\/code>\u65b9\u6cd5\uff0c\u6b64\u65f6\u6211\u4eec\u53ef\u4ee5\u501f\u52a9<code>event.source<\/code>\u5224\u65ad\u72b6\u6001\u53d8\u5316\u7684\u6765\u6e90\u662f\u4ec0\u4e48\u3002<\/p>\n<p>\u4f8b\u5982\uff1a<\/p>\n<pre>&lt;p&gt;\u5173\u95ed\u6765\u6e90\u662f\uff1a&lt;output id=\"output\"&gt;&lt;\/output&gt;&lt;\/p&gt;\r\n&lt;p&gt;&lt;button commandfor=\"dialog\" command=\"show-modal\"&gt;\u663e\u793a\u5f39\u6846&lt;\/button&gt;&lt;\/p&gt;\r\n&lt;dialog id=\"dialog\" closedby=\"any\"&gt;\r\n  &lt;form method=\"dialog\"&gt;\r\n    &lt;button&gt;form\u5173\u95ed\u6309\u94ae&lt;\/button&gt;\r\n  &lt;\/form&gt;\r\n  &lt;p&gt;\r\n    &lt;button commandfor=\"dialog\" command=\"close\"&gt;command\u5173\u95ed\u6309\u94ae&lt;\/button&gt;\r\n  &lt;\/p&gt;\r\n&lt;\/dialog&gt;\r\n&lt;script&gt;\r\n  dialog.addEventListener(\"toggle\", function (event) {\r\n    if (event.newState === \"closed\") {\r\n      output.textContent = event.source?.textContent || '\u6765\u6e90\u672a\u77e5';\r\n    }\r\n  });\r\n&lt;\/script&gt;<\/pre>\n<p>\u5b9e\u65f6\u8fd0\u884c\u6548\u679c\u5982\u4e0b\uff08Chrome 140+\uff0cSafari 16.5+\uff09\uff1a<\/p>\n<div style=\"border:1px solid #ddd; padding: 1rem;\">\n<p>\u5173\u95ed\u6765\u6e90\u662f\uff1a<output id=\"output\"><\/output><\/p>\n<p><button commandfor=\"dialog\" command=\"show-modal\">\u663e\u793a\u5f39\u6846<\/button><\/p>\n<p><dialog id=\"dialog\" closedby=\"any\"><\/p>\n<form method=\"dialog\"><button>form\u5173\u95ed\u6309\u94ae<\/button><\/form>\n<p><button commandfor=\"dialog\" command=\"close\">command\u5173\u95ed\u6309\u94ae<\/button><\/p>\n<p><\/dialog><\/div>\n<p><script>\n  dialog.addEventListener(\"toggle\", function (event) {\n    if (event.newState === \"closed\") {\n      output.textContent = event.source?.textContent || '\u6765\u6e90\u672a\u77e5';\n    }\n  });\n<\/script><\/p>\n<p>\u6839\u636e\u6211\u7684\u6d4b\u8bd5\uff0c\u53ea\u6709\u901a\u8fc7<code>command<\/code>\u6307\u4ee4\u89e6\u53d1\u7684\u5f39\u6846\u5173\u95ed\u6309\u94ae\uff0c\u624d\u4f1a\u88ab<code>event.source<\/code>\u8bc6\u522b\u51fa\u6765\uff0c\u5176\u4ed6\u4efb\u4f55\u5185\u7f6e\u7684\u5f39\u6846\u5173\u95ed\u884c\u4e3a\uff0c<code>event.source<\/code>\u90fd\u662f<code>null<\/code>\uff0c\u5305\u62ecJS\u6267\u884c\u7684<code>dialog.close()<\/code>\u547d\u4ee4\u4e5f\u662f\u5982\u6b64\u3002<\/p>\n<p>\u770b\u6765\uff0c\u8fd9\u79cd\u573a\u666f\u4e0b\uff0c\u8fd8\u9700\u8981\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\u533a\u5206\u3002<\/p>\n<ul>\n<li>\u5e38\u89c4\u5f39\u6846\u5173\u95ed\uff0c\u5982\u679c\u65e0\u6cd5\u8bc6\u522b<code>event.source<\/code>\uff0c\u5219\u53ef\u4ee5\u8ba4\u4e3a\u662f<code>close()<\/code>\u884c\u4e3a\u89e6\u53d1\uff1b<\/li>\n<li>\u5982\u679c\u662f<code>method=\"dialog\"<\/code>\u8868\u5355\u89e6\u53d1\u7684\u5f39\u6846\u5173\u95ed\uff0c\u662f\u4f1a\u89e6\u53d1\u5f39\u6846\u7684submit\u4e8b\u4ef6\u7684\uff1b\n<pre>dialog.addEventListener(\"submit\", function (event) {\r\n  console.log('submit');\r\n});<\/pre>\n<\/li>\n<li>\u5982\u679c\u662fESC\u5feb\u6377\u952e\u5173\u95ed\uff0c\u53ef\u4ee5\u901a\u8fc7cancel\u4e8b\u4ef6\u8bc6\u522b\u3002<\/li>\n<\/ul>\n<p>\u6700\u540e\uff0c\u9644\u4e0a<code>event.source<\/code>\u7684\u517c\u5bb9\u6027\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202606\/2026-6-22_211718.png\" width=\"575\" height=\"354\" alt=\"toggle\u4e8b\u4ef6source\u5c5e\u6027\u517c\u5bb9\u6027\" class=\"alignnone size-medium\" \/><\/p>\n<h3>\u4e09\u3001\u7ed3\u675f\u65f6\u5019\u8bf4\u7684\u8bdd<\/h3>\n<p>\u5988\u5440\uff0c\u6211\u4e70\u7684\u6052\u751f\u79d1\u6280\u8dcc\u7684\u7239\u5988\u90fd\u4e0d\u8ba4\u8bc6\u4e86\u3002<\/p>\n<p>\u516c\u53f8\u80a1\u7968\u4e5f\u65b0\u4f4e\u4e86\uff0c\u6ca1\u8bdd\u8bf4\u3002<\/p>\n<p>\u6211\u8fd8\u4e70\u4e86\u7406\u60f3\uff0c\u4e24\u6b21\u7ffb\u500d\u90fd\u6ca1\u5356\uff0c\u7ed3\u679c\u73b0\u5728\u8170\u65a9\u3002<\/p>\n<p>\u8fd8\u4e0d\u5982\u53bb\u6284AI\u80a1\u3002<\/p>\n<p>\u7b97\u4e86\uff0c\u5343\u65a4\u96be\u4e70\u65e9\u77e5\u9053\uff0c\u4eba\u662f\u65e0\u6cd5\u8d5a\u5230\u8ba4\u77e5\u4ee5\u5916\u7684\u94b1\u7684\u3002<\/p>\n<p>\u6211\u5bb6\u5a49\u513f\u8868\u793a\u8d5e\u540c\uff01<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202606\/2026-6-22_213054.webp\" width=\"139\" height=\"129\" alt=\"\u5357\u5bab\u5a49\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u4f1a\u7ecf\u5e38\u66f4\u65b0\u77e5\u8bc6\u70b9\u4ee5\u53ca\u4fee\u6b63\u4e00\u4e9b\u9519\u8bef\uff0c\u56e0\u6b64\u8f6c\u8f7d\u8bf7\u4fdd\u7559\u539f\u51fa\u5904\uff0c\u65b9\u4fbf\u6eaf\u6e90\uff0c\u907f\u514d\u9648\u65e7\u9519\u8bef\u77e5\u8bc6\u7684\u8bef\u5bfc\uff0c\u540c\u65f6\u6709\u66f4\u597d\u7684\u9605\u8bfb\u4f53\u9a8c\u3002<br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=12237\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=12237<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202606\/2026-6-22_213822.webp\" width=\"160\" height=\"102\" alt=\"\u5c01\u9762\u5360\u4f4d\u56fe html command\" class=\"alignright size-medium\" loading=\"lazy\" \/><\/p>\n<p>\u4ecb\u7ecd\u4e24\u4e2a\u6211\u89c9\u5f97\u76f8\u5f53\u5b9e\u7528\u7684HTML\u548cDOM\u65b0\u7279\u6027\uff0c\u81ea\u6b64\uff0c\u65e0JS\u4ea4\u4e92\u7684\u573a\u666f\u518d\u6b21\u4e30\u5bcc\u4e86\u4e00\u5c42\uff0c\u6709\u5174\u8da3\u7684\u53ef\u4ee5\u8fdb\u6765\u4e86\u89e3\u4e00\u756a\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[2122,2123,2121,1207,1394,1935,1952,1517],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/12237"}],"collection":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=12237"}],"version-history":[{"count":10,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/12237\/revisions"}],"predecessor-version":[{"id":12275,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/12237\/revisions\/12275"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=12237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=12237"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=12237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}