{"id":346,"date":"2009-04-24T22:51:00","date_gmt":"2009-04-24T02:51:00","guid":{"rendered":""},"modified":"2009-04-24T22:51:00","modified_gmt":"2009-04-24T02:51:00","slug":"","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/346.html","title":{"rendered":"JavaScript\u4e00\u4e9b\u65b9\u6cd5\u548c\u5c5e\u6027\u603b\u7ed3"},"content":{"rendered":"<p><html><head><meta http-equiv=\"Content-Type\" content=\"text\/html; charset=utf-8\" \/><title>JavaScript\u4e00\u4e9b\u65b9\u6cd5\u548c\u5c5e\u6027\u603b\u7ed3<\/title><\/head><body><\/p>\n<h1 style=\"display:none\">JavaScript\u4e00\u4e9b\u65b9\u6cd5\u548c\u5c5e\u6027\u603b\u7ed3<\/h1>\n<div>\n<div class=\"postBody\">\n<p>javascript \u4e00\u4e9b\u4e8b\u4ef6\uff0c\u5c5e\u6027<br \/>\njavascript\u4e8b\u4ef6\u67e5\u8be2\u7efc\u5408<br \/>\nclick() \u5bf9\u8c61.click() \u4f7f\u5bf9\u8c61\u88ab\u70b9\u51fb\u3002<br \/>\nclosed \u5bf9\u8c61.closed \u5bf9\u8c61\u7a97\u53e3\u662f\u5426\u5df2\u5173\u95edtrue\/false<br \/>\nclearTimeout(\u5bf9\u8c61) \u6e05\u9664\u5df2\u8bbe\u7f6e\u7684setTimeout\u5bf9\u8c61<br \/>\nclearInterval(\u5bf9\u8c61) \u6e05\u9664\u5df2\u8bbe\u7f6e\u7684setInterval\u5bf9\u8c61<br \/>\nconfirm(&quot;\u63d0\u793a\u4fe1\u606f&quot;) \u5f39\u51fa\u786e\u8ba4\u6846\uff0c\u786e\u5b9a\u8fd4\u56detrue\u53d6\u6d88\u8fd4\u56defalse<br \/>\ncursor:\u6837\u5f0f \u66f4\u6539\u9f20\u6807\u6837\u5f0f hand crosshair text wait help default auto e\/s\/w\/n-resize<br \/>\nevent.clientX \u8fd4\u56de\u6700\u540e\u4e00\u6b21\u70b9\u51fb\u9f20\u6807X\u5750\u6807\u503c\uff1b<br \/>\nevent.clientY \u8fd4\u56de\u6700\u540e\u4e00\u6b21\u70b9\u51fb\u9f20\u6807Y\u5750\u6807\u503c\uff1b<br \/>\nevent.offsetX \u8fd4\u56de\u5f53\u524d\u9f20\u6807\u60ac\u505cX\u5750\u6807\u503c<br \/>\nevent.offsetY \u8fd4\u56de\u5f53\u524d\u9f20\u6807\u60ac\u505cY\u5750\u6807\u503c<\/p>\n<p>document.write(document.lastModified) \u7f51\u9875\u6700\u540e\u4e00\u6b21\u66f4\u65b0\u65f6\u95f4<br \/>\ndocument.ondblclick=x \u5f53\u53cc\u51fb\u9f20\u6807\u4ea7\u751f\u4e8b\u4ef6<br \/>\ndocument.onmousedown=x \u5355\u51fb\u9f20\u6807\u952e\u4ea7\u751f\u4e8b\u4ef6<\/p>\n<p>document.body.scrollTop; \u8fd4\u56de\u548c\u8bbe\u7f6e\u5f53\u524d\u7ad6\u5411\u6eda\u52a8\u6761\u7684\u5750\u6807\u503c\uff0c\u987b\u4e0e\u51fd\u6570\u914d\u5408,<br \/>\ndocument.body.scrollLeft; \u8fd4\u56de\u548c\u8bbe\u7f6e\u5f53\u524d\u6a2a\u5411\u6eda\u52a8\u52a1\u7684\u5750\u6807\u503c\uff0c\u987b\u4e0e\u51fd\u6570\u914d\u5408\uff0c<br \/>\ndocument.title document.title=&quot;message&quot;; \u5f53\u524d\u7a97\u53e3\u7684\u6807\u9898\u680f\u6587\u5b57<br \/>\ndocument.bgcolor document.bgcolor=&quot;\u989c\u8272\u503c&quot;; \u6539\u53d8\u7a97\u53e3\u80cc\u666f\u989c\u8272<br \/>\ndocument.Fgcolor document.Fgcolor=&quot;\u989c\u8272\u503c&quot;; \u6539\u53d8\u6b63\u6587\u989c\u8272<br \/>\ndocument.linkcolor document.linkcolor=&quot;\u989c\u8272\u503c&quot;; \u6539\u53d8\u8d85\u8054\u63a5\u989c\u8272<br \/>\ndocument.alinkcolor document.alinkcolor=&quot;\u989c\u8272\u503c&quot;; \u6539\u53d8\u6b63\u70b9\u51fb\u8054\u63a5\u7684\u989c\u8272<br \/>\ndocument.VlinkColor document.VlinkColor=&quot;\u989c\u8272\u503c&quot;; \u6539\u53d8\u5df2\u8bbf\u95ee\u8054\u63a5\u7684\u989c\u8272<br \/>\ndocument.forms.length \u8fd4\u56de\u5f53\u524d\u9875form\u8868\u5355\u6570<br \/>\ndocument.anchors.length \u8fd4\u56de\u5f53\u524d\u9875\u951a\u7684\u6570\u91cf<br \/>\ndocument.links.length \u8fd4\u56de\u5f53\u524d\u9875\u8054\u63a5\u7684\u6570\u91cf<br \/>\ndocument.onmousedown=x \u5355\u51fb\u9f20\u6807\u89e6\u53d1\u4e8b\u4ef6<br \/>\ndocument.ondblclick=x \u53cc\u51fb\u9f20\u6807\u89e6\u53d1\u4e8b\u4ef6<br \/>\ndefaultStatus window.status=defaultStatus; \u5c06\u72b6\u6001\u680f\u8bbe\u7f6e\u9ed8\u8ba4\u663e\u793a<\/p>\n<p>function function xx(){&#8230;} \u5b9a\u4e49\u51fd\u6570<br \/>\nisNumeric \u5224\u65ad\u662f\u5426\u662f\u6570\u5b57<br \/>\ninnerHTML xx=\u5bf9\u8c61.innerHTML \u8f93\u5165\u67d0\u5bf9\u8c61\u6807\u7b7e\u4e2d\u7684html\u6e90\u4ee3\u7801<br \/>\ninnerText divid.innerText=xx \u5c06\u4ee5div\u5b9a\u4f4d\u4ee5id\u547d\u540d\u7684\u5bf9\u8c61\u503c\u8bbe\u4e3aXX<\/p>\n<p>location.reload(); \u4f7f\u672c\u9875\u5237\u65b0\uff0ctarget\u53ef\u7b49\u4e8e\u4e00\u4e2a\u5237\u65b0\u7684\u7f51\u9875<\/p>\n<p>Math.random() \u968f\u673a\u6db5\u6570,\u53ea\u80fd\u662f0\u52301\u4e4b\u95f4\u7684\u6570,\u5982\u679c\u8981\u5f97\u5230\u5176\u5b83\u6570,\u53ef\u4ee5\u4e3a*10,\u518d\u53d6\u6574<br \/>\nMath.floor(number) \u5c06\u5bf9\u8c61number\u8f6c\u4e3a\u6574\u6570\uff0c\u820d\u53d6\u6240\u6709\u5c0f\u6570<br \/>\nMath.min(1,2) \u8fd4\u56de1,2\u54ea\u4e2a\u5c0f<br \/>\nMath.max(1,2) \u8fd4\u56de1,2\u54ea\u4e2a\u5927<\/p>\n<p>navigator.appName \u8fd4\u56de\u5f53\u524d\u6d4f\u89c8\u5668\u540d\u79f0<br \/>\nnavigator.appVersion \u8fd4\u56de\u5f53\u524d\u6d4f\u89c8\u5668\u7248\u672c\u53f7<br \/>\nnavigator.appCodeName \u8fd4\u56de\u5f53\u524d\u6d4f\u89c8\u5668\u4ee3\u7801\u540d\u5b57<br \/>\nnavigator.userAgent \u8fd4\u56de\u5f53\u524d\u6d4f\u89c8\u5668\u7528\u6237\u4ee3\u6807\u5fd7<\/p>\n<p>onsubmit onsubmit=&quot;return(xx())&quot; \u4f7f\u7528\u51fd\u6570\u8fd4\u56de\u503c<br \/>\nopener opener.document.\u5bf9\u8c61 \u63a7\u5236\u539f\u6253\u5f00\u7a97\u4f53\u5bf9\u8c61<\/p>\n<p>prompt xx=window.prompt(&quot;\u63d0\u793a\u4fe1\u606f&quot;,&quot;\u9884\u5b9a\u503c&quot;); \u8f93\u5165\u8bed\u53e5<br \/>\nparent parent.\u6846\u67b6\u540d.\u5bf9\u8c61 \u63a7\u5236\u6846\u67b6\u9875\u9762<\/p>\n<p>return return false \u8fd4\u56de\u503c<br \/>\nrandom \u968f\u673a\u53c2\u6570\uff080\u81f31\u4e4b\u95f4\uff09<br \/>\nreset() form.reset(); \u4f7fform\u8868\u5355\u5185\u7684\u6570\u636e\u91cd\u7f6e<\/p>\n<p>split(&quot;&quot;) string.split(&quot;&quot;) \u5c06string\u5bf9\u8c61\u5b57\u7b26\u4ee5\u9017\u53f7\u9694\u5f00<br \/>\nsubmit() form\u5bf9\u8c61.submit() \u4f7fform\u5bf9\u8c61\u63d0\u4ea4\u6570\u636e<\/p>\n<p>String\u5bf9\u8c61\u7684 charAt(x)\u5bf9\u8c61 \u53cd\u56de\u6307\u5b9a\u5bf9\u8c61\u7684\u7b2c\u591a\u5c11\u4f4d\u7684\u5b57\u6bcd<br \/>\nlastIndexOf(&quot;string&quot;) \u4ece\u53f3\u5230\u5de6\u8be2\u627e\u6307\u5b9a\u5b57\u7b26\uff0c\u6ca1\u6709\u8fd4\u56de-1<br \/>\nindexOf(&quot;string&quot;) \u4ece\u5de6\u5230\u53f3\u8be2\u627e\u6307\u5b9a\u5b57\u7b26\uff0c\u6ca1\u6709\u8fd4\u56de-1<br \/>\nLowerCase() \u5c06\u5bf9\u8c61\u5168\u90e8\u8f6c\u4e3a\u5c0f\u5199 <br \/>\nUpperCase() \u5c06\u5bf9\u8c61\u5168\u90e8\u8f6c\u4e3a\u5927\u5199<br \/>\nsubstring(0,5) string.substring(x,x) \u8fd4\u56de\u5bf9\u8c61\u4e2d\u4ece0\u52305\u7684\u5b57\u7b26<br \/>\nsetTimeout(&quot;function&quot;,time) \u8bbe\u7f6e\u4e00\u4e2a\u8d85\u65f6\u5bf9\u8c61<br \/>\nsetInterval(&quot;function&quot;,time) \u8bbe\u7f6e\u4e00\u4e2a\u8d85\u65f6\u5bf9\u8c61<\/p>\n<p>toLocaleString() x.toLocaleString() \u4ecex\u65f6\u95f4\u5bf9\u8c61\u4e2d\u83b7\u53d6\u65f6\u95f4\uff0c\u4ee5\u5b57\u7b26\u4e32\u578b\u5f0f\u5b58\u5728<br \/>\ntypeof(\u53d8\u91cf\u540d) \u68c0\u67e5\u53d8\u91cf\u7684\u7c7b\u578b\uff0c\u503c\u6709\uff1aString,Boolean,Object,Function,Underfined<\/p>\n<p>window.event.button==1\/2\/3 \u9f20\u6807\u952e\u5de6\u952e\u7b49\u4e8e1\u53f3\u952e\u7b49\u4e8e2\u4e24\u4e2a\u952e\u4e00\u8d77\u6309\u4e3a3<br \/>\nwindow.screen.availWidth \u8fd4\u56de\u5f53\u524d\u5c4f\u5e55\u5bbd\u5ea6(\u7a7a\u767d\u7a7a\u95f4)<br \/>\nwindow.screen.availHeight \u8fd4\u56de\u5f53\u524d\u5c4f\u5e55\u9ad8\u5ea6(\u7a7a\u767d\u7a7a\u95f4)<br \/>\nwindow.screen.width \u8fd4\u56de\u5f53\u524d\u5c4f\u5e55\u5bbd\u5ea6(\u5206\u8fa8\u7387\u503c)<br \/>\nwindow.screen.height \u8fd4\u56de\u5f53\u524d\u5c4f\u5e55\u9ad8\u5ea6(\u5206\u8fa8\u7387\u503c)<br \/>\nwindow.document.body.offsetHeight; \u8fd4\u56de\u5f53\u524d\u7f51\u9875\u9ad8\u5ea6<br \/>\nwindow.document.body.offsetWidth; \u8fd4\u56de\u5f53\u524d\u7f51\u9875\u5bbd\u5ea6<br \/>\nwindow.resizeTo(0,0) \u5c06\u7a97\u53e3\u8bbe\u7f6e\u5bbd\u9ad8<br \/>\nwindow.moveTo(0,0) \u5c06\u7a97\u53e3\u79fb\u5230\u67d0\u4f4d\u7f6e<br \/>\nwindow.focus() \u4f7f\u5f53\u524d\u7a97\u53e3\u83b7\u5f97\u7126\u70b9<br \/>\nwindow.scroll(x,y) \u7a97\u53e3\u6eda\u52a8\u6761\u5750\u6807\uff0cy\u63a7\u5236\u4e0a\u4e0b\u79fb\u52a8\uff0c\u987b\u4e0e\u51fd\u6570\u914d\u5408<br \/>\nwindow.open() window.open(&quot;\u5730\u5740&quot;,&quot;\u540d\u79f0&quot;,&quot;\u5c5e\u6027&quot;) <br \/>\n\u5c5e\u6027:toolbar(\u5de5\u5177\u680f),location(\u5730\u5740\u680f),directions,status(\u72b6\u6001\u680f),<br \/>\nmenubar(\u83dc\u5355\u680f),scrollbar(\u6eda\u52a8\u6761),resizable(\u6539\u53d8\u5927\u5c0f), width(\u5bbd),height(\u9ad8),fullscreen(\u5168 \u5c4f),scrollbars(\u5168\u5c4f\u65f6\u65e0\u6eda\u52a8\u6761\u65e0\u53c2 \u6570,channelmode(\u5bbd\u5c4f),left(\u6253\u5f00\u7a97\u53e3x\u5750\u6807),top(\u6253\u5f00\u7a97\u53e3y\u5750\u6807)<br \/>\nwindow.location = &#8216;view-source:&#8217; + window.location.href \u5e94\u7528\u4e8b\u4ef6\u67e5\u770b\u7f51\u9875\u6e90\u4ee3\u7801;<\/p>\n<p>\na=new Date(); \/\/\u521b\u5efaa\u4e3a\u4e00\u4e2a\u65b0\u7684\u65f6\u671f\u5bf9\u8c61<br \/>\ny=a.getYear(); \/\/y\u7684\u503c\u4e3a\u4ece\u5bf9\u8c61a\u4e2d\u83b7\u53d6\u5e74\u4efd\u503c \u4e24\u4f4d\u6570\u5e74\u4efd<br \/>\ny1=a.getFullYear(); \/\/\u83b7\u53d6\u5168\u5e74\u4efd\u6570 \u56db\u4f4d\u6570\u5e74\u4efd<br \/>\nm=a.getMonth(); \/\/\u83b7\u53d6\u6708\u4efd\u503c<br \/>\nd=a.getDate(); \/\/\u83b7\u53d6\u65e5\u671f\u503c<br \/>\nd1=a.getDay(); \/\/\u83b7\u53d6\u5f53\u524d\u661f\u671f\u503c<br \/>\nh=a.getHours(); \/\/\u83b7\u53d6\u5f53\u524d\u5c0f\u65f6\u6570<br \/>\nm1=a.getMinutes(); \/\/\u83b7\u53d6\u5f53\u524d\u5206\u949f\u6570<br \/>\ns=a.getSeconds(); \/\/\u83b7\u53d6\u5f53\u524d\u79d2\u949f\u6570<\/p>\n<p>\n\u5bf9\u8c61.style.fontSize=&quot;\u6587\u5b57\u5927\u5c0f&quot;;<br \/>\n\u5355\u4f4d\uff1amm\/cm\/in\u82f1\u5bf8\/pc\u5e15\/pt\u70b9\/px\u8c61\u7d20\/em\u6587\u5b57\u9ad8<br \/>\n1in=1.25cm<br \/>\n1pc=12pt<br \/>\n1pt=1.2px(800*600\u5206\u8fa9\u7387\u4e0b)<\/p>\n<p>\u6587\u672c\u5b57\u4f53\u5c5e\u6027\uff1a<br \/>\nfontSize\u5927\u5c0f<br \/>\nfamily\u5b57\u4f53<br \/>\ncolor\u989c\u8272<br \/>\nfontStyle\u98ce\u683c\uff0c\u53d6\u503c\u4e3anormal\u4e00\u822c,italic\u659c\u4f53,oblique\u659c\u4f53\u4e14\u52a0\u7c97<br \/>\nfontWeight\u52a0\u7c97,\u53d6\u503c\u4e3a100\u5230900\u4e0d\u7b49,900\u6700\u7c97,light,normal,bold<br \/>\nletterSpacing\u95f4\u8ddd,\u66f4\u6539\u6587\u5b57\u95f4\u8ddd\u79bb,\u53d6\u503c\u4e3a,1pt,10px,1cm<br \/>\ntextDecoration:\u6587\u5b57\u4fee\u9970;\u53d6\u503c,none\u4e0d\u4fee\u9970,underline\u4e0b\u5212\u7ebf,overline\u4e0a\u5212\u7ebf<br \/>\nbackground:\u6587\u5b57\u80cc\u666f\u989c\u8272,<br \/>\nbackgroundImage:\u80cc\u666f\u56fe\u7247,\u53d6\u503c\u4e3a\u56fe\u7247\u7684\u63d2\u5165\u8def\u5f84<\/p>\n<p>\n\u70b9\u51fb\u7f51\u9875\u6b63\u6587\u51fd\u6570\u8c03\u7528\u89e6\u53d1\u5668\uff1a<\/p>\n<p>1.onClick \u5f53\u5bf9\u8c61\u88ab\u70b9\u51fb<br \/>\n2.onLoad \u5f53\u7f51\u9875\u6253\u5f00,\u53ea\u80fd\u4e66\u5199\u5728body\u4e2d<br \/>\n3.onUnload \u5f53\u7f51\u9875\u5173\u95ed\u6216\u79bb\u5f00\u65f6,\u53ea\u80fd\u4e66\u5199\u5728body\u4e2d<br \/>\n4.onmouseover \u5f53\u9f20\u6807\u60ac\u4e8e\u5176\u4e0a\u65f6<br \/>\n5.onmouseout \u5f53\u9f20\u6807\u79bb\u5f00\u5bf9\u8c61\u65f6<br \/>\n6.onmouseup \u5f53\u9f20\u6807\u677e\u5f00<br \/>\n7.onmousedown \u5f53\u9f20\u6807\u6309\u4e0b\u952e<br \/>\n8.onFocus \u5f53\u5bf9\u8c61\u83b7\u53d6\u7126\u70b9\u65f6<br \/>\n9.onSelect \u5f53\u5bf9\u8c61\u7684\u6587\u672c\u88ab\u9009\u4e2d\u65f6<br \/>\n10.onChange \u5f53\u5bf9\u8c61\u7684\u5185\u5bb9\u88ab\u6539\u53d8<br \/>\n11.onBlur \u5f53\u5bf9\u8c61\u5931\u53bb\u7126\u70b9<br \/>\nonsubmit=return(ss())\u8868\u5355\u8c03\u7528\u65f6\u8fd4\u56de\u7684\u503c<\/p>\n<p>\u76f4\u7ebf border-bottom:1x solid black<br \/>\n\u865a\u7ebf border-bottom:1x dotted black<br \/>\n\u70b9\u5212\u7ebf border-bottom:2x dashed black<br \/>\n\u53cc\u7ebf border-bottom:5x double black<br \/>\n\u69fd\u72b6 border-bottom:1x groove black<br \/>\n\u810a\u72b6 border-bottom:1x ridge black<\/p>\n<\/div>\n<\/div>\n<p><\/body><\/html><\/p>\n","protected":false},"excerpt":{"rendered":"<p>JavaScript\u4e00\u4e9b\u65b9\u6cd5\u548c\u5c5e\u6027\u603b\u7ed3 JavaScript\u4e00\u4e9b\u65b9\u6cd5\u548c\u5c5e\u6027\u603b\u7ed3 javascript \u4e00\u4e9b\u4e8b\u4ef6 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-346","post","type-post","status-publish","format-standard","hentry","category-code_related"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/346","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=346"}],"version-history":[{"count":0,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/346\/revisions"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}