{"id":2016,"date":"2024-11-10T12:28:02","date_gmt":"2024-11-10T04:28:02","guid":{"rendered":"https:\/\/fwq.ai\/blog\/2016\/"},"modified":"2024-11-10T12:28:02","modified_gmt":"2024-11-10T04:28:02","slug":"%e5%a6%82%e4%bd%95%e5%b1%80%e9%83%a8%e6%9b%b4%e6%94%b9%e9%a1%b5%e9%9d%a2%e5%9b%be%e7%89%87%ef%bc%8c%e6%97%a0%e9%9c%80%e5%88%b7%e6%96%b0%e6%95%b4%e4%b8%aa%e9%a1%b5%e9%9d%a2%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/2016\/","title":{"rendered":"\u5982\u4f55\u5c40\u90e8\u66f4\u6539\u9875\u9762\u56fe\u7247\uff0c\u65e0\u9700\u5237\u65b0\u6574\u4e2a\u9875\u9762\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173063001346594.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u5c40\u90e8\u66f4\u6539\u9875\u9762\u56fe\u7247\uff0c\u65e0\u9700\u5237\u65b0\u6574\u4e2a\u9875\u9762\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u5c40\u90e8\u66f4\u6539\u9875\u9762\u56fe\u7247\uff0c\u65e0\u9700\u5237\u65b0\u6574\u4e2a\u9875\u9762\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5c40\u90e8\u66f4\u6539\u9875\u9762\u56fe\u7247<\/strong><\/p>\n<p>\u672c\u95ee\u9898\u6d89\u53ca\u5982\u4f55\u4fee\u6539\u9875\u9762\u4e0a\u4e00\u4e2a\u7279\u5b9a\u533a\u57df\u7684\u56fe\u50cf\uff0c\u800c\u65e0\u9700\u91cd\u65b0\u52a0\u8f7d\u6574\u4e2a\u9875\u9762\u3002\u5177\u4f53\u573a\u666f\u5982\u4e0b\uff1a<\/p>\n<p>\u60a8\u6709\u4e00\u4e2a\u5305\u542b\u4e0b\u62c9\u9009\u62e9\u5668\u7684 <\/p>\n<p>  \uff0c\u5176\u4e2d\u5217\u51fa\u4e86\u4e0d\u540c\u9009\u9879\u3002\u5728\u53e6\u4e00\u4e2a  \u4e2d\uff0c\u6709\u4e00\u4e2a\u56fe\u50cf\u3002\u56fe\u50cf\u5e94\u6839\u636e\u4e0b\u62c9\u5217\u8868\u5f53\u524d\u9009\u5b9a\u7684\u503c\u66f4\u6539\u3002 <\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6cd5\uff1a<\/strong><\/p>\n<p><strong>\u4f7f\u7528 javascript<\/strong><\/p>\n<p>\u6b64\u95ee\u9898\u53ef\u4ee5\u7528 javascript \u8f7b\u677e\u89e3\u51b3\u3002\u4ee5\u4e0b\u662f\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li><strong>\u5c06\u56fe\u50cf\u653e\u5165\u4e00\u4e2a\u5355\u72ec\u7684  \u4e2d\uff1a\n<pre>&lt;div class=\"image-container\"&gt;\n    @@##@@\n&lt;\/div&gt;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li><strong>\u6dfb\u52a0 onchange \u4e8b\u4ef6\u76d1\u542c\u5668\u5230\u4e0b\u62c9\u5217\u8868\uff1a<\/strong><\/li>\n<\/ol>\n<pre>&lt;select id=\"floor_id\" onchange=\"updateimage(this.value)\"&gt;\n    &lt;!-- \u9009\u9879 --&gt;\n&lt;\/select&gt;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li><strong>\u7f16\u5199 javascript \u51fd\u6570 updateimage<\/strong><\/li>\n<\/ol>\n<p>\u6b64\u51fd\u6570\u5c06\u6839\u636e\u4e0b\u62c9\u5217\u8868\u9009\u5b9a\u7684\u503c\u66f4\u6539\u56fe\u50cf\u7684 src \u5c5e\u6027\u3002<\/p>\n<pre>function updateImage(value) {\n    \/\/ \u83b7\u53d6 image-container \u5143\u7d20\n    var imageContainer = document.querySelector('.image-container');\n\n    \/\/ \u66f4\u65b0\u56fe\u50cf\u6e90\n    imageContainer.getElementsByTagName('img')[0].src = value;\n}<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u901a\u8fc7\u4f7f\u7528 js \u548c\u8fd9\u4e9b\u7b80\u5355\u7684\u6b65\u9aa4\uff0c\u60a8\u53ef\u4ee5\u5b9e\u73b0\u9875\u9762\u4e0a\u7279\u5b9a\u56fe\u50cf\u7684\u52a8\u6001\u66f4\u65b0\uff0c\u800c\u65e0\u9700\u5237\u65b0\u6574\u4e2a\u9875\u9762\u3002<\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/www.php.cn\/faq\/%24%7Bfloor.image%7D\" style=\"max-width:90%\" class=\"aligncenter\" title=\"\u5982\u4f55\u5c40\u90e8\u66f4\u6539\u9875\u9762\u56fe\u7247\uff0c\u65e0\u9700\u5237\u65b0\u6574\u4e2a\u9875\u9762\uff1f\u63d2\u56fe1\" alt=\"\u5982\u4f55\u5c40\u90e8\u66f4\u6539\u9875\u9762\u56fe\u7247\uff0c\u65e0\u9700\u5237\u65b0\u6574\u4e2a\u9875\u9762\uff1f\u63d2\u56fe1\" \/> <\/strong><\/li>\n<\/ol>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5c40\u90e8\u66f4\u6539\u9875\u9762\u56fe\u7247\uff0c\u65e0\u9700\u5237\u65b0\u6574\u4e2a\u9875\u9762\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u5c40\u90e8\u66f4\u6539\u9875\u9762\u56fe\u7247 \u672c\u95ee\u9898\u6d89\u53ca\u5982\u4f55\u4fee\u6539\u9875\u9762\u4e0a\u4e00\u4e2a\u7279\u5b9a\u533a\u57df\u7684\u56fe\u50cf\uff0c\u800c\u65e0\u9700\u91cd\u65b0\u52a0\u8f7d\u6574\u4e2a\u9875\u9762\u3002\u5177\u4f53\u573a\u666f\u5982\u4e0b\uff1a \u60a8\u6709\u4e00\u4e2a\u5305\u542b\u4e0b\u62c9\u9009\u62e9\u5668\u7684 \uff0c\u5176\u4e2d\u5217\u51fa\u4e86\u4e0d\u540c\u9009\u9879\u3002\u5728\u53e6\u4e00\u4e2a \u4e2d\uff0c\u6709\u4e00\u4e2a\u56fe\u50cf\u3002\u56fe\u50cf\u5e94\u6839\u636e\u4e0b\u62c9\u5217\u8868\u5f53\u524d\u9009\u5b9a\u7684\u503c\u66f4\u6539\u3002 \u89e3\u51b3\u65b9\u6cd5\uff1a \u4f7f\u7528 javascript \u6b64\u95ee\u9898\u53ef\u4ee5\u7528 javascript \u8f7b\u677e\u89e3\u51b3\u3002\u4ee5\u4e0b\u662f\u6b65\u9aa4\uff1a \u5c06\u56fe\u50cf\u653e\u5165\u4e00\u4e2a\u5355\u72ec\u7684 \u4e2d\uff1a &lt;div class=&#8221;image-container&#8221;&gt; @@##@@ &lt;\/div&gt; \u767b\u5f55\u540e\u590d\u5236 \u6dfb\u52a0 onchange \u4e8b\u4ef6\u76d1\u542c\u5668\u5230\u4e0b\u62c9\u5217\u8868\uff1a &lt;select id=&#8221;floor_id&#8221; onchange=&#8221;updateimage(this.value)&#8221;&gt; &lt;!&#8211; \u9009\u9879 &#8211;&gt; &lt;\/select&gt; \u767b\u5f55\u540e\u590d\u5236 \u7f16\u5199 javascript \u51fd\u6570 updateimage \u6b64\u51fd\u6570\u5c06\u6839\u636e\u4e0b\u62c9\u5217\u8868\u9009\u5b9a\u7684\u503c\u66f4\u6539\u56fe\u50cf\u7684 src \u5c5e\u6027\u3002 function updateImage(value) { \/\/ \u83b7\u53d6 image-container \u5143\u7d20 var imageContainer = document.querySelector(&#8216;.image-container&#8217;); \/\/ \u66f4\u65b0\u56fe\u50cf\u6e90 imageContainer.getElementsByTagName(&#8216;img&#8217;)[0].src = value; } \u767b\u5f55\u540e\u590d\u5236 \u901a\u8fc7\u4f7f\u7528 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-2016","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/2016","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=2016"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/2016\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=2016"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=2016"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=2016"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}