{"id":280085,"date":"2021-01-12T16:26:12","date_gmt":"2021-01-12T08:26:12","guid":{"rendered":"http:\/\/4563.org\/?p=280085"},"modified":"2021-01-12T16:26:12","modified_gmt":"2021-01-12T08:26:12","slug":"%e8%af%b7%e6%95%99%e4%b8%aa%e6%80%9d%e8%b7%af%ef%bc%8c%e6%9c%80%e7%bb%88%e6%95%88%e6%9e%9c%e4%b8%8a%e6%9d%a5%e8%ae%b2%ef%bc%8c%e5%8e%9f%e7%94%9f-js-%e5%a6%82%e4%bd%95%e5%8f%af%e4%bb%a5%e4%bd%bf","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=280085","title":{"rendered":"\u8bf7\u6559\u4e2a\u601d\u8def\uff0c\u6700\u7ec8\u6548\u679c\u4e0a\u6765\u8bb2\uff0c\u539f\u751f JS \u5982\u4f55\u53ef\u4ee5\u4f7f\u6574\u884c\u8868\u683c tr \u5185\u5bb9\u88ab\u4e00\u4e2a\u7ea2\u6846\u5305\u8d77\u6765\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u8bf7\u6559\u4e2a\u601d\u8def\uff0c\u6700\u7ec8\u6548\u679c\u4e0a\u6765\u8bb2\uff0c\u539f\u751f JS \u5982\u4f55\u53ef\u4ee5\u4f7f\u6574\u884c\u8868\u683c tr \u5185\u5bb9\u88ab\u4e00\u4e2a\u7ea2\u6846\u5305\u8d77\u6765\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : qazwsxkevin <\/span>  <span><i><\/i> 3<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u60c5\u51b5\uff1a<br \/> 1 \u3001\u662f\u5728\u201c\u589e\u5f3a\u201d\u522b\u4eba\u7528\u6570\u7ec4\u7ed8\u5236\u7684\u52a8\u6001\u8868\u683c\uff0c\u60f3\u5728\u4e0a\u9762\u7565\u52a0\u6548\u679c\uff0c<br \/> 2 \u3001\u60c5\u51b5\u4e0d\u5141\u8bb8\u7528 Jquery\uff0c\u4e3b\u8981\u539f\u56e0\u662f\u516c\u53f8\u53bb\u516c\u7f51\u7684\u9632\u706b\u5899\u6ca1\u6709\u5bf9 Jquery \u7684 CDN \u5730\u5740\u653e\u767d\u540d\u5355\u3002<br \/> 3 \u3001\u56e0\u4e3a\u8868\u683c\u91cc\u9762\u672c\u8eab\u6709\u4e9b td \u683c\u5b50\u81ea\u5e26\u4e86\u989c\u8272\uff08\u989c\u8272\u6709\u5177\u4f53\u4ee3\u8868\u4e0d\u540c\u7684\u4fe1\u606f\uff09\uff0c\u5982\u679c onmouseover,onmouseout \u53bb\u6539\u989c\u8272\u53d8\u9ad8\u4eae\uff0c\u53cd\u800c\u5f71\u54cd\u4e86\u4f7f\u7528\u3002\u3002\u3002<br \/> 4 \u3001\u6240\u4ee5\u5c31\u60f3\u5230\u4e86\u5f04\u4e2a\u7ea2\u8272\u7684\u6846\u6765\u8868\u73b0\u9f20\u6807\u843d\u5728\u4e86\u8fd9\u884c\u5185\u5bb9\u4e0a\u3002\u3002\u3002<br \/> 5 \u3001\u8bd5\u7740\u5199\u4e86\u4e00\u4e0b\uff0c\u5bf9 tr \u5404\u79cd.style \u53c2\u6570\u8c03\u4e86\u4e00\u4e0b\uff0c\u597d\u50cf\u6ca1\u90a3\u4e48\u7b80\u5355\uff1f\u3002\u3002\u3002<br \/> 6 \u3001\u8138\u539a\u95ee\uff0c\u53ef\u6709\u73b0\u6210\u7684\u53c2\u8003\u4e00\u4e0b\uff1f <\/p>\n<pre><code>    \/\/\u9ad8\u4eae TR\uff0c\u76ee\u524d\u53ea\u505a\u4e86\u5b57\u4f53\u81ea\u52a8\u52a0\u7c97\uff0c\u6548\u679c\u8fd8\u4e0d\u8db3\u591f     var tab = document.getElementById('dataShow');     var trs = tab.getElementsByTagName('tr');\/\/\u83b7\u53d6\u6240\u6709\u7684 tr \u6807\u7b7e     for (var i = 0; i &lt; trs.length; i++) {         trs[i].onmouseover = function () {   \/\/\u9f20\u6807\u79fb\u52a8\u4e0a\u4e8b\u4ef6             if (this.style.fontWeight != \"bolder\") {                 this.style.fontWeight = \"bolder\";             }             }          trs[i].onmouseout = function () {  \/\/\u9f20\u6807\u79fb\u51fa\u4e8b\u4ef6             if (this.style.fontWeight == \"bolder\") {                 this.style.fontWeight = \"normal\";             }         }     } <\/code><\/pre>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>8<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4939005\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : versionlin <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7528 css \u4e0d\u884c\u4e48                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4939006\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : VDimos <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u505a\u8868\u683c\u6837\u5f0f\u7684\u90fd\u662f\u5927\u795e\uff0c\u5c24\u5176\u5bf9 tr thead tbody \u505a\u6837\u5f0f\u7684\u3002\u8fd9\u4e9b\u6807\u7b7e\u6837\u5f0f\u5f88\u591a\u90fd\u4e0d\u80fd\u7528                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4939007\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : walpurgis <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             var tab = document.getElementById(&#8216;dataShow&#8217;);<br \/> tab.style.borderCollapse = &#8216;collapse&#8217;; \/\/ tr \u8bbe\u7f6e border \u9700\u8981 table \u4e3a collapse<\/p>\n<p> var trs = document.getElementsByTagName(&#8216;tr&#8217;);<br \/> for (let i = 0; i &lt; trs.length; i++) {<br \/> trs[i].addEventListener(&#8216;mouseenter&#8217;, () =&gt; {<br \/> trs[i].style.border = &#8216;1px solid red&#8217;<br \/> })<br \/> trs[i].addEventListener(&#8216;mouseleave&#8217;, () =&gt; {<br \/> trs[i].style.border = &#8221;<br \/> })<br \/> }                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4939008\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Mutoo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             CSS \u7684 :hover + outline \u975e\u5e38\u5bb9\u6613\u5b9e\u73b0<br \/>\u7528 outline \u6709\u51e0\u4e2a\u597d\u5904\uff1a<br \/>1) \u5f88\u5c11\u88ab\u4f7f\u7528\uff0c\u4e0d\u4f1a\u8ddf\u539f\u6709\u7684 border \u51b2\u7a81<br \/>2) \u7eaf\u89c6\u89c9\u6548\u679c\uff0c\u4e0d\u6539\u53d8\u5e03\u5c40                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4939009\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xuewuchen <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5443\u3002\u3002\u6211\u662f\u65b0\u624b\u4e0d\u592a\u660e\u767d\u554a\uff0c\u4f60\u4e0b\u8f7d\u4e00\u4e2a Jquery \u5230\u672c\u5730\u7528\u4e0d\u4e45\u53ef\u4ee5\u4e86\u5417\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4939010\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : renmu123 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @xuewuchen \u534e\u751f\u4f60\u53d1\u73b0\u76f2\u70b9\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4939011\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : devwolf <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u9664\u4e86#\u8bf4\u7684 outline\uff0c\u6211\u4e5f\u7ecf\u5e38\u7528 box-shadow\uff0c\u603b\u4e4b\u662f border \u6837\u5f0f\u7684\u66ff\u4ee3\u65b9\u6848\u3002<br \/>\u5927 div \u5957\u5c0f div \u6f0f\u4e00\u4e2a\u6846\u4e5f\u662f\u4e00\u79cd\u66ff\u4ee3\uff0c\u4e0d\u8fc7\u770b\u63cf\u8ff0\u91cc\u201c\u683c\u5b50\u81ea\u5e26\u4e86\u989c\u8272\u6709\u5177\u4f53\u4ee3\u8868\u4e0d\u540c\u7684\u4fe1\u606f\u201d,\u597d\u50cf\u4e0d\u80fd\u7528\u5927\u76d2\u5957\u5c0f\u76d2\u3002<\/p>\n<p>\u4e0d\u77e5\u9053\u80fd\u4e0d\u80fd\u7528\u53cd\u8272\uff08\u5c31\u662f\u767d\u5b57\u5f69\u5e95\uff09,\u5f53\u7136\u6211\u6709\u770b\u5230\u63cf\u8ff0 4 \u63d0\u5230\u7684\u201c\u7ea2\u8272\u6846\u201d\u9700\u6c42\uff0c\u53ea\u662f\u6211\u8fd9\u8fb9\u505a\u8868\u683c\u6548\u679c\u65f6\u4e5f\u5e38\u7528\u53cd\u8272\uff0c\u63d0\u8bae\u4e00\u4e0b                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4939012\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : qazwsxkevin <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6ca1\u6709\u6765\u5f97\u53ca\u53ca\u65f6\u56de\u590d\u5927\u5bb6\uff0c\u8bf4\u58f0\u8c22\u8c22\u4e86\uff0c\u6700\u540e\u6211\u662f\u8fd9\u6837\u5b8c\u6210\u7684\uff0c\u5e94\u8be5\u662f\u7528\u4e86 CSS \u5427\u3002\u3002\u3002<\/p>\n<p>&#8220;`<br \/> \/\/\u9ad8\u4eae TR<br \/> var tab = document.getElementById(&#8216;showTable&#8217;);<br \/> var trs = tab.getElementsByTagName(&#8216;tr&#8217;);\/\/\u83b7\u53d6\u6240\u6709\u7684 tr \u6807\u7b7e<br \/> for (var i = 0; i &lt; trs.length; i++) {<br \/> if (i == 0) {<br \/> continue<br \/> }<\/p>\n<p> trs[i].onmouseover = function () { \/\/\u9f20\u6807\u79fb\u52a8\u4e0a\u4e8b\u4ef6<br \/> if (this.style.fontWeight != &#8220;bolder&#8221;) {<br \/> this.style.fontWeight = &#8220;bolder&#8221;;<br \/> this.style.outline = &#8220;#ff0e05 inset thick&#8221;;<br \/> }<br \/> }<\/p>\n<p> trs[i].onmouseout = function () { \/\/\u9f20\u6807\u79fb\u51fa\u4e8b\u4ef6<br \/> if (this.style.fontWeight == &#8220;bolder&#8221;) {<br \/> this.style.fontWeight = &#8220;normal&#8221;;<br \/> this.style.outline = &#8220;&#8221;;<br \/> }<br \/> }<br \/> }<br \/>&#8220;`                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u8bf7\u6559\u4e2a\u601d\u8def\uff0c\u6700\u7ec8\u6548\u679c\u4e0a\u6765\u8bb2\uff0c\u539f\u751f &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/280085"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=280085"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/280085\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=280085"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=280085"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=280085"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}