{"id":118,"date":"2010-09-30T10:26:28","date_gmt":"2010-09-30T10:26:28","guid":{"rendered":"http:\/\/enjoyasp.net\/?p=118"},"modified":"2010-09-30T10:26:28","modified_gmt":"2010-09-30T10:26:28","slug":"js%e5%9f%ba%e7%a1%80","status":"publish","type":"post","link":"https:\/\/enjoyasp.net\/index.php\/2010\/09\/30\/js%e5%9f%ba%e7%a1%80\/","title":{"rendered":"JS\u57fa\u7840"},"content":{"rendered":"<p>?1\uff0c\u8f93\u51fa\uff1a<\/p>\n<p>&lt;html&gt;<br \/>\n&lt;body&gt;<\/p>\n<p>&lt;script type=&#8221;text\/javascript&#8221;&gt;<br \/>\ndocument.write(&#8220;&lt;h1&gt;Hello World!&lt;\/h1&gt;&#8221;);<br \/>\n&lt;\/script&gt;<\/p>\n<p>&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<\/p>\n<p>2\uff0c \u4e00\u4e9b\u6d4f\u89c8\u5668\u4e0d\u652f\u6301js, \u8981\u5728script\u4e2d\u52a0\u4e0a&lt;!&#8211; &#8211;&gt;\u5f53\u4e0d\u652f\u6301\u65f6\u5c31\u5c4f\u853d\u6389\u3002<br \/>\n&lt;script type=&#8221;text\/javascript&#8221;&gt;<br \/>\n&lt;!&#8211;<br \/>\ndocument.write(&#8220;Hello World!&#8221;);<br \/>\n\/\/&#8211;&gt;??????????????????? \/\/\u662fjs\u7684\u6ce8\u91ca\uff0c\u9632\u6b62js\u6267\u884c &#8211;&gt;<br \/>\n&lt;\/script&gt;<\/p>\n<p>3\uff0c\u6ce8\u91ca\u7528:\/**\/ \u6216\/\/???? \u5f15\u7528\u5916\u90e8js\u6587\u4ef6\uff0c<br \/>\n?<\/p>\n<p>4,\u5b57\u7b26\u4e32\u76f8\u52a0\uff0c\u7528&#8221;+&#8221; \uff1b\u4e00\u4e2a\u5b57\u7b26\u4e32\u4e0e\u4e00\u6570\u636e\u76f8\u52a0\u7ed3\u679c\u4e3a\u4e00\u5b57\u7b26\u4e32, \u8f6c\u4e49\u5b57\u7b26\u7528&#8221;\\&#8221; \u5982\u622a\u65ad&#8221;document.write(&#8220;Hello \\<br \/>\nWorld!&#8221;);<\/p>\n<p>5\uff0c\u56e0\u5934\u90e8\u52a0\u8f7d\u5728body\u4e4b\u524d\uff0c\u6545\u6700\u597djs\u51fd\u6570\u5728head\u4e2d\u5b9a\u4e49\uff0c\u4ee5\u786e\u4fdd\u5728\u8c03\u7528\u4e4b\u524djs\u51fd\u6570\u5df2\u7ecf\u52a0\u8f7d\u5b8c\u6bd5\u3002<\/p>\n<p>6\uff0c if , switch , for , while \u540cjava ,\u904d\u5386\u6570\u7ec4\u53ef\u7528 for ( i in mycars), \u5f02\u5e38\u5904\u7406\uff1a<br \/>\ntry ? { ? throw &#8220;Err2&#8221;; ? } catch(err) ? { ? \/\/Handle errors here ? }<\/p>\n<p>7, \u4e8b\u4ef6\u6709\uff1aonFocus, onBlur and onChange,onSubmit,onMouseOver,onMouseOut;<\/p>\n<p>8, JS \u5927\u5c0f\u5199\u654f\u611f<\/p>\n<p>9, \u5b57\u7b26\u4e32\u65b9\u6cd5\uff1a length, toUpperCase(),indexOf; \u67d0\u5b57\u7b26\u7b2c\u4e00\u6b21\u51fa\u73b0\u7684\u4f4d\u7f6e\uff0c\u82e5\u65e0\uff0c\u8fd4\u56de-1<\/p>\n<p>10, \u65e5\u671f\u64cd\u4f5c: var myDate=new Date();? myDate.setDate(myDate.getDate()+5); today;<\/p>\n<p>11, \u6570\u7ec4\uff1avar myCars=new Array(&#8220;Saab&#8221;,&#8221;Volvo&#8221;,&#8221;BMW&#8221;);<\/p>\n<p>12\uff0cboolean \u503c\uff1a var myBoolean=new Boolean(false);<\/p>\n<p>13\uff0c\u6570\u5b66\u51fd\u6570\uff1a Math.PI\uff0c Math.sqrt(16)\uff0c Math.LOG2E\uff0cMath.round(4.7) = 5\uff0c Math.random()<\/p>\n<p>14\uff0c<a href=\"http:\/\/www.w3schools.com\/jsref\/jsref_obj_regexp.asp\">\u6b63\u5219\u8868\u8fbe\u5f0f<\/a>\uff1a\u540cjava\u7c7b\u4f3c\uff0cvar patt1=new RegExp(&#8220;e&#8221;); document.write(patt1.test(&#8220;The best things in life are free&#8221;)); \u6d4b\u8bd5\u662f\u5426\u542b\u6709\u201ce\u201d,\u82e5\u5b58\u5728\uff0c\u8fd4\u56detrue<\/p>\n<p>15, \u521b\u5efacookie: var exdate=new Date(); exdate.setDate(exdate.getDate()+expiredays); document.cookie=+ &#8220;mycookiee&#8221;+exdate.toGMTString());<\/p>\n<p>16, with \u5f53\u5f97\u5230\u4e00\u4e2a\u7236\u5bb9\u5668\u7684\u5f15\u7528\u6b64\uff0c\u5229\u7528with,\u5176\u5185\u7684\u5143\u7d20\u5c31\u4e0d\u5fc5\u52a0\u4e0b\u5f15\u5bb9\u5668\u7684\u540d\u79f0\u3002<br \/>\nfunction validate_form(thisform)<br \/>\n{<br \/>\nwith (thisform)<br \/>\n? {<br \/>\n? ??? userName = &#8220;123&#8221;;<br \/>\n? }<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>?1\uff0c\u8f93\u51fa\uff1a &lt;html&gt; &lt;body&gt; &lt;script type=&#038;#8221 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-118","post","type-post","status-publish","format-standard","hentry","category-javascript"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/comments?post=118"}],"version-history":[{"count":0,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/118\/revisions"}],"wp:attachment":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/media?parent=118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/categories?post=118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/tags?post=118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}