{"id":266957,"date":"2021-01-01T17:56:09","date_gmt":"2021-01-01T09:56:09","guid":{"rendered":"http:\/\/4563.org\/?p=266957"},"modified":"2021-01-01T17:56:09","modified_gmt":"2021-01-01T09:56:09","slug":"%e5%89%8d%e7%ab%af%e5%b0%8f%e7%99%bd%ef%bc%8c%e8%af%b7%e6%95%99%e4%b8%80%e4%b8%aa%e5%85%b3%e4%ba%8e%e7%94%a8-js-%e7%82%b9%e5%87%bb%e9%a1%b5%e9%9d%a2%e5%85%83%e7%b4%a0%e7%9a%84%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=266957","title":{"rendered":"\u524d\u7aef\u5c0f\u767d\uff0c\u8bf7\u6559\u4e00\u4e2a\u5173\u4e8e\u7528 js \u70b9\u51fb\u9875\u9762\u5143\u7d20\u7684\u95ee\u9898\u3002"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u524d\u7aef\u5c0f\u767d\uff0c\u8bf7\u6559\u4e00\u4e2a\u5173\u4e8e\u7528 js \u70b9\u51fb\u9875\u9762\u5143\u7d20\u7684\u95ee\u9898\u3002               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Marsss <\/span>  <span><i><\/i> 3<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        \u6211\u5728\u6d4b\u8bd5\u67d0\u4e2a\u7f51\u7ad9\u7684\u524d\u7aef\u4ee3\u7801\u7684\u65f6\u5019\uff0c\u7528 chrome \u6253\u5f00\u7f51\u7ad9\uff0c\u6211\u53d1\u73b0\u8fd9\u7f51\u7ad9\u7684\u524d\u7aef\u6709\u5f88\u591a\u5730\u65b9\u9f20\u6807\u653e\u4e0a\u53bb\uff0c\u9f20\u6807\u53d8\u4e3a\u624b\u7684\u5f62\u72b6\uff0c\u9f20\u6807\u70b9\u51fb\u6b63\u5e38\u3002\u4f46\u662f\u5f53\u6211\u6253\u5f00 F12\uff0c\u5728 console \u91cc\u9762\uff0c\u7528 document.getElementsByClassName \u9009\u62e9\u5230\u8fd9\u4e2a div \u5143\u7d20\uff0c\u7136\u540e document.getElementsByClassName(&#8220;divClassName&#8221;).click() \u5374\u4e0d\u8d77\u4f5c\u7528\u3002<\/p>\n<p>\u6211\u786e\u5b9a\u6211\u786e\u5b9e\u9009\u62e9\u5230\u8fd9\u4e2a\u5143\u7d20\u4e86\uff0c\u56e0\u4e3a\u5728 console \u91cc\u9f20\u6807\u79fb\u4e0a\u53bb\uff0c\u80fd\u770b\u5230\u9875\u9762\u786e\u5b9e\u662f\u5bf9\u5e94\u7684 div \u5143\u7d20\u3002\u6211\u8bd5\u8fc7\u6362\u90bb\u8fd1\u7684 div \u90fd\u662f\u4e00\u6837\u4e0d\u8d77\u4f5c\u7528\u3002<\/p>\n<p>\u6211\u5bf9\u524d\u7aef\u786e\u5b9e\u4e86\u89e3\u5f88\u5c11\uff0c\u4e0d\u660e\u767d\u8fd9\u91cc\u7684\u539f\u7406\uff0c\u6211\u4ee5\u4e3a\u9f20\u6807\u80fd\u70b9\u7684\uff0c\u7528 js \u4e5f\u4e00\u5b9a\u6709\u65b9\u6cd5\u70b9\u51fb\u3002<\/p>\n<p>\u8fd8\u8bf7\u5927\u5bb6\u6307\u70b9\u4e00\u4e0b\u3002      <\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>14<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4859809\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : kop1989 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5047\u5b9a\u6ca1\u6709\u5176\u4ed6\u9519\u8bef\u7684\u8bdd\uff0c\u63a8\u65ad\u662f\u672a\u89c1\u5f97\u4ed6\u628a\u4f60\u7406\u89e3\u7684\u70b9\u51fb\u4e8b\u4ef6\u653e\u5728\u4e86\u201cclick\u201d\u4e8b\u4ef6\u4e2d\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4859810\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : mara1 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             1. document.getElementsByClassName \u53ef\u80fd\u62ff\u5230\u591a\u4e2a\u5143\u7d20<br \/>2. \u60f3\u8c61 1 \u4e2a\u6846\u91cc\u9762\u5957\u4e86\u4e00\u4e2a\u6846\uff0c\u4f60\u53ef\u80fd\u624b\u70b9\u7684\u662f\u5185\u90e8\u7684\u6846\uff0cjs \u70b9\u7684\u5916\u90e8\u7684\u6846<\/p>\n<p>\u5176\u4ed6\u6211\u60f3\u4e0d\u6765\u4e86\uff0c\u4e0b\u8865\u5145                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4859811\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : darknoll <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             document.getElementsByClassName(&#8220;divClassName&#8221;) \u4e0d\u662f\u8fd4\u56de\u6570\u7ec4\u5417                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4859812\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : tutou <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             document.getElementsByClassName(&#8220;divClassName&#8221;) \u8fd4\u56de\u7684\u662f\u6570\u7ec4\uff0c\u6253\u5370\u770b\u770b\u4e0d\u5c31\u77e5\u9053\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4859813\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jydeng <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7528\u5f00\u53d1\u8005\u5de5\u5177\u76f4\u63a5\u9009\u4e2d\u5143\u7d20\uff0c\u7136\u540e$0.click()\u3002<br \/>\u6216\u8005\u5c31\u662f\u5982\u4e0a\u8bf4\u7684\uff0c\u6ca1\u6709\u7ed1\u5b9a\u5728 click \u4e8b\u4ef6\u4e2d\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4859814\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yzliua <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0a\u8bf4\u7684\u5bf9\uff0c\u5047\u5b9a\u53ea\u6709\u4e00\u4e2a\u540c\u7c7b\u5143\u7d20\uff0c\u4f60\u4e5f\u5f97\u4e0b\u9762\u8fd9\u79cd\u7528\u6cd5<br \/>document.getElementsByClassName(&#8220;divClassName&#8221;)[0].click()                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4859815\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : LiubaiQ <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             cursor:pointer \u7684\u6548\u679c\uff0c\u7834\u6848\uff0c\u5404\u4f4d\u6563\u4e86\u5427                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4859816\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wangjiang <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e5f\u8bb8\u53ea\u662f cursor:pointer                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4859817\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Marsss <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u662f\u7528\u4e86[0]\u6765\u53d6\u4e86\u5355\u72ec\u7684 div \u7684\uff0c\u4e5f\u8bd5\u4e86 @jydeng \u8bf4\u7684\u65b9\u6cd5\uff0c\u7528\u5f00\u53d1\u8005\u5de5\u5177\u76f4\u63a5\u9009\u4e2d\u5143\u7d20\uff0c\u7136\u540e$0 \u4e5f\u770b\u5230\u9009\u4e2d\u4e86,\u7136\u540e$0.click()\u4e5f\u662f\u65e0\u6548\uff0c\u76f8\u90bb\u7684 div \u90fd\u8bd5\u8fc7\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4859818\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Marsss <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0a\u4e0a\u7684 cursor:pointer \u662f\u6307\u53ea\u662f\u4e00\u4e2a\u6548\u679c\u4e48\uff0c\u4f46\u662f\u6211\u7528\u9f20\u6807\u70b9\u4e86\uff0c\u80fd\u89c2\u5bdf\u5230\u9875\u9762\u6837\u5f0f\u7684\u6539\u53d8\uff08\u786e\u5b9e\u6ca1\u89c2\u5bdf\u5230\u6709\u94fe\u63a5\u8df3\u8f6c\uff09\uff0c\u6211\u8be5\u5982\u4f55\u7528 js \u6765\u5b9e\u73b0\u8fd9\u4e2a\u70b9\u51fb\u540e\u9875\u9762\u6837\u5f0f\u6539\u53d8\u7684\u6548\u679c\u5462                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4859819\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : putaozhenhaochi <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0a\u8bf4\u7684 CSS .                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4859820\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : shyrock <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u524d\u7aef\u5c0f\u767d\u731c\u6d4b\uff0c\u70b9\u51fb\u4e8b\u4ef6\u53ef\u80fd\u4e0d\u662f\u7ed1\u5b9a\u7684\u8fd9\u4e2a\u5143\u7d20\uff0c\u800c\u53ef\u80fd\u662f\u4e0a\u7ea7\u5143\u7d20\u751a\u81f3 document \u3002<br \/>\u6bd4\u5982\u5728 document.onclick()\u91cc\u9762\u5224\u65ad\u70b9\u51fb\u843d\u70b9\u5e76\u5904\u7406\u3002\u8fd9\u6837\u4f60 getElements().click()\u65e0\u6cd5\u6a21\u62df\u89e6\u53d1\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4859821\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dengshen <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u653e\u4e0a\u53bb\uff1f hover \u89e6\u53d1\u7684 pointer                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4859822\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dd112389 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5efa\u8bae\u8d34\u7f51\u5740\u548c\u56fe\u7247.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u7aef\u5c0f\u767d\uff0c\u8bf7\u6559\u4e00\u4e2a\u5173\u4e8e\u7528 js \u70b9&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\/266957"}],"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=266957"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/266957\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=266957"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=266957"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=266957"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}