锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲a级成人片在线观看,亚洲电影在线免费观看,国产亚洲精品无码专区http://m.tkk7.com/smcdl/category/22723.html鎶借薄鍗蟲槸絀猴紝絀哄嵆鏄娊璞°?/description>zh-cnMon, 19 Oct 2009 18:36:52 GMTMon, 19 Oct 2009 18:36:52 GMT60鍏充簬鏍峰紡琛ㄥ璞tyle涓巆urrentStyle鐨勫尯鍒?/title><link>http://m.tkk7.com/smcdl/archive/2009/10/18/298782.html</link><dc:creator>teddy</dc:creator><author>teddy</author><pubDate>Sun, 18 Oct 2009 14:59:00 GMT</pubDate><guid>http://m.tkk7.com/smcdl/archive/2009/10/18/298782.html</guid><wfw:comment>http://m.tkk7.com/smcdl/comments/298782.html</wfw:comment><comments>http://m.tkk7.com/smcdl/archive/2009/10/18/298782.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/smcdl/comments/commentRss/298782.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/smcdl/services/trackbacks/298782.html</trackback:ping><description><![CDATA[style鍜宑urrentStyle閮借兘鐢ㄦ潵鍙栧緱褰撳墠鏍峰紡琛ㄤ腑鐨勪俊鎭紝浣嗘槸style鍙兘鍙栧緱鍦℉TML涓敤style澹版槑鐨勬牱寮忚〃淇℃伅錛屾棤娉曞彇寰楅氳繃class澹版槑鐨勬牱寮忚〃淇℃伅錛岃宑urrentStyle涓ょ澹版槑鏂瑰紡閮藉彲浠ュ彇寰椼? <img src ="http://m.tkk7.com/smcdl/aggbug/298782.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/smcdl/" target="_blank">teddy</a> 2009-10-18 22:59 <a href="http://m.tkk7.com/smcdl/archive/2009/10/18/298782.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍏充簬JavaScript鐨刢loneNode鏂規硶瀵逛簬鑺傜偣涓婄殑浜嬩歡clone闂鐨勭爺絀躲?/title><link>http://m.tkk7.com/smcdl/archive/2009/10/18/298743.html</link><dc:creator>teddy</dc:creator><author>teddy</author><pubDate>Sun, 18 Oct 2009 05:28:00 GMT</pubDate><guid>http://m.tkk7.com/smcdl/archive/2009/10/18/298743.html</guid><wfw:comment>http://m.tkk7.com/smcdl/comments/298743.html</wfw:comment><comments>http://m.tkk7.com/smcdl/archive/2009/10/18/298743.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/smcdl/comments/commentRss/298743.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/smcdl/services/trackbacks/298743.html</trackback:ping><description><![CDATA[<p>鎴戠殑嫻嬭瘯鐜鏄疘E8錛屽浜庝簨浠禼lone瑕佹敞鎰忎竴涓?鐐癸細<br /> 1.榪愯鏃舵坊鍔犵殑浜嬩歡涓嶄細琚厠闅嗭紝濡備笅渚嬶細</p> <div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="color: #008080">1</span><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /><span style="color: #000000">a </span><span style="color: #000000">=</span><span style="color: #000000"> document.getElementById('a'); </span><span style="color: #008000">//</span><span style="color: #008000">鍋囪a鏄竴涓猟iv</span><span style="color: #008000"><br /> </span><span style="color: #008080">2   </span><span style="color: #000000">a.onclick </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">function</span><span style="color: #000000"> () </span><span id="Codehighlighter1_70_95_Open_Text"><span style="color: #000000">{ alert(</span><span style="color: #0000ff">this</span><span style="color: #000000">.innerHTML); }</span></span><span style="color: #000000"><br /> </span><span style="color: #008080">3</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />b </span><span style="color: #000000">=</span><span style="color: #000000"> a.cloneNode();</span></div> <br /> 2.瑙f瀽HTML鏃跺師鏉ュ甫鐨勪簨浠朵細琚厠闅嗭紝濡備笅渚嬶細<br /> <div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="color: #008080">1</span><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /><span style="color: #000000"><</span><span style="color: #000000">div id</span><span style="color: #000000">=</span><span style="color: #000000">'a' onclick</span><span style="color: #000000">=</span><span style="color: #000000">'alert(</span><span style="color: #0000ff">this</span><span style="color: #000000">.innerHTML)'</span><span style="color: #000000">></span><span style="color: #000000">aaaa</span><span style="color: #000000"></</span><span style="color: #000000">div</span><span style="color: #000000">></span></div> <br /> 3.閫氳繃attachEvent娣誨姞鐨勪簨浠朵細琚厠闅嗭紝濡備笅渚嬶細<br /> <div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="color: #008080">1</span><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /><span style="color: #000000">a </span><span style="color: #000000">=</span><span style="color: #000000"> document.getElementById('a');<br /> </span><span style="color: #008080">2    </span><span style="color: #000000">a.attachEvent('onclick', </span><span style="color: #0000ff">function</span><span style="color: #000000"> () </span><span id="Codehighlighter1_71_96_Open_Text"><span style="color: #000000">{<br /> </span><span style="color: #008080">3          </span><span style="color: #000000">alert(</span><span style="color: #0000ff">this</span><span style="color: #000000">.innerHTML);<br /> </span><span style="color: #008080">4    </span><span style="color: #000000">}</span></span><span style="color: #000000">);<br /> </span><span style="color: #008080">5</span><span style="color: #000000"><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />b </span><span style="color: #000000">=</span><span style="color: #000000"> a.cloneNode();</span></div> <br /> 鏈鍚庡鏋滄兂鍦╟lone鏃跺皢鑺傜偣鍏朵腑鐨勫瓙鑺傜偣涓鍚宑lone鐨勮瘽錛岃浣跨敤cloneNode(true)銆? <img src ="http://m.tkk7.com/smcdl/aggbug/298743.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/smcdl/" target="_blank">teddy</a> 2009-10-18 13:28 <a href="http://m.tkk7.com/smcdl/archive/2009/10/18/298743.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍙傝働rototype鐨凜lass.create鍐欎簡涓涓被浼肩殑瀹炵幇錛屼絾鏄笉鏄疪uby like OOP錛屼嬌鐢ㄤ笂鏇村儚Java銆?/title><link>http://m.tkk7.com/smcdl/archive/2009/06/09/280773.html</link><dc:creator>teddy</dc:creator><author>teddy</author><pubDate>Mon, 08 Jun 2009 16:04:00 GMT</pubDate><guid>http://m.tkk7.com/smcdl/archive/2009/06/09/280773.html</guid><wfw:comment>http://m.tkk7.com/smcdl/comments/280773.html</wfw:comment><comments>http://m.tkk7.com/smcdl/archive/2009/06/09/280773.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/smcdl/comments/commentRss/280773.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/smcdl/services/trackbacks/280773.html</trackback:ping><description><![CDATA[<span style="font-size: 10pt;">瀹炵幇浠g爜錛?br /> <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> $A (Arguments) {<br /> </span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> result </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> [];<br /> </span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; i </span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);"> Arguments.length; i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">)<br /> </span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);">        result.push(Arguments[i]);<br /> </span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> result;<br /> </span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 0, 0);">}<br /> </span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);">Class </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> {<br /> </span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);">    create : </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> () {<br /> </span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> args </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> $A(arguments);<br /> </span><span style="color: rgb(0, 128, 128);">11</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> parentClass </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> args.shift();<br /> </span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> properties;<br /> </span><span style="color: rgb(0, 128, 128);">13</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (parentClass </span><span style="color: rgb(0, 0, 255);">instanceof</span><span style="color: rgb(0, 0, 0);"> Function)<br /> </span><span style="color: rgb(0, 128, 128);">14</span> <span style="color: rgb(0, 0, 0);">            properties </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> args.shift();<br /> </span><span style="color: rgb(0, 128, 128);">15</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (parentClass </span><span style="color: rgb(0, 0, 255);">instanceof</span><span style="color: rgb(0, 0, 0);"> Object) {<br /> </span><span style="color: rgb(0, 128, 128);">16</span> <span style="color: rgb(0, 0, 0);">            properties </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> parentClass;<br /> </span><span style="color: rgb(0, 128, 128);">17</span> <span style="color: rgb(0, 0, 0);">            parentClass </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);">18</span> <span style="color: rgb(0, 0, 0);">        }<br /> </span><span style="color: rgb(0, 128, 128);">19</span> <span style="color: rgb(0, 0, 0);">        <br /> </span><span style="color: rgb(0, 128, 128);">20</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> klazz </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> () {<br /> </span><span style="color: rgb(0, 128, 128);">21</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.initialize) </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.initialize.apply(</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">, arguments);<br /> </span><span style="color: rgb(0, 128, 128);">22</span> <span style="color: rgb(0, 0, 0);">        };<br /> </span><span style="color: rgb(0, 128, 128);">23</span> <span style="color: rgb(0, 0, 0);">        <br /> </span><span style="color: rgb(0, 128, 128);">24</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (parentClass) {<br /> </span><span style="color: rgb(0, 128, 128);">25</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> tmpClass </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Function;<br /> </span><span style="color: rgb(0, 128, 128);">26</span> <span style="color: rgb(0, 0, 0);">            tmpClass.prototype </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> parentClass.prototype;<br /> </span><span style="color: rgb(0, 128, 128);">27</span> <span style="color: rgb(0, 0, 0);">            klazz.prototype </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> tmpClass();<br /> </span><span style="color: rgb(0, 128, 128);">28</span> <span style="color: rgb(0, 0, 0);">            klazz.prototype.constructor </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> klazz;<br /> </span><span style="color: rgb(0, 128, 128);">29</span> <span style="color: rgb(0, 0, 0);">        }<br /> </span><span style="color: rgb(0, 128, 128);">30</span> <span style="color: rgb(0, 0, 0);">        <br /> </span><span style="color: rgb(0, 128, 128);">31</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> key </span><span style="color: rgb(0, 0, 255);">in</span><span style="color: rgb(0, 0, 0);"> properties) {<br /> </span><span style="color: rgb(0, 128, 128);">32</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (properties[key] </span><span style="color: rgb(0, 0, 255);">instanceof</span><span style="color: rgb(0, 0, 0);"> Function </span><span style="color: rgb(0, 0, 0);">&&</span><span style="color: rgb(0, 0, 0);"> klazz.prototype[key] </span><span style="color: rgb(0, 0, 255);">instanceof</span><span style="color: rgb(0, 0, 0);"> Function) {<br /> </span><strong><span style="color: rgb(0, 128, 128);">33</span> </strong><span style="color: rgb(0, 0, 0);"><strong>                </strong><strong>klazz.prototype[key] </strong></span><strong><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> () {<br /> </span><span style="color: rgb(0, 128, 128);">34</span> <span style="color: rgb(0, 0, 0);">                    </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> _parent </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> klazz.prototype[key];<br /> </span><span style="color: rgb(0, 128, 128);">35</span> <span style="color: rgb(0, 0, 0);">                    </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> _method </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> properties[key];<br /> </span><span style="color: rgb(0, 128, 128);">36</span> <span style="color: rgb(0, 0, 0);">                    </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);">() {<br /> </span><span style="color: rgb(0, 128, 128);">37</span> <span style="color: rgb(0, 0, 0);">                        </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> _this </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);">38</span> <span style="color: rgb(0, 0, 0);">                        $super </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);">(){<br /> </span><span style="color: rgb(0, 128, 128);">39</span> <span style="color: rgb(0, 0, 0);">                            _parent.apply(_this, arguments);<br /> </span><span style="color: rgb(0, 128, 128);">40</span> <span style="color: rgb(0, 0, 0);">                        }<br /> </span><span style="color: rgb(0, 128, 128);">41</span> <span style="color: rgb(0, 0, 0);">                        _method.apply(</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">, arguments);<br /> </span><span style="color: rgb(0, 128, 128);">42</span> <span style="color: rgb(0, 0, 0);">                    }<br /> </span><span style="color: rgb(0, 128, 128);">43</span> </strong><span style="color: rgb(0, 0, 0);"><strong>                })();</strong><br /> </span><span style="color: rgb(0, 128, 128);">44</span> <span style="color: rgb(0, 0, 0);">            }<br /> </span><span style="color: rgb(0, 128, 128);">45</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"> <br /> </span><span style="color: rgb(0, 128, 128);">46</span> <span style="color: rgb(0, 0, 0);">                klazz.prototype[key] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> properties[key];<br /> </span><span style="color: rgb(0, 128, 128);">47</span> <span style="color: rgb(0, 0, 0);">        }<br /> </span><span style="color: rgb(0, 128, 128);">48</span> <span style="color: rgb(0, 0, 0);">        <br /> </span><span style="color: rgb(0, 128, 128);">49</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> klazz;<br /> </span><span style="color: rgb(0, 128, 128);">50</span> <span style="color: rgb(0, 0, 0);">    }<br /> </span><span style="color: rgb(0, 128, 128);">51</span> <span style="color: rgb(0, 0, 0);">}</span></div> <br /> 嫻嬭瘯浠g爜錛?br /> <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);">            T </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> Class.create({<br /> </span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);">                initialize : </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> (tt,mm) {<br /> </span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);">                    alert(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">initialize T<img src="http://m.tkk7.com/Images/dot.gif" alt="" /></span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br /> </span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);">                    </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.tt </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> tt;<br /> </span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 0, 0);">                    </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.mm </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> mm;<br /> </span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);">                },<br /> </span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);">                l : </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> () {<br /> </span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);">                    alert(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">f</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br /> </span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);">                },<br /> </span><span style="color: rgb(0, 128, 128);">11</span> <span style="color: rgb(0, 0, 0);">                f : </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> () {<br /> </span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);">                    alert(</span><span style="color: rgb(0, 0, 0);">123</span><span style="color: rgb(0, 0, 0);">);<br /> </span><span style="color: rgb(0, 128, 128);">13</span> <span style="color: rgb(0, 0, 0);">                }<br /> </span><span style="color: rgb(0, 128, 128);">14</span> <span style="color: rgb(0, 0, 0);">            });<br /> </span><span style="color: rgb(0, 128, 128);">15</span> <span style="color: rgb(0, 0, 0);">            <br /> </span><span style="color: rgb(0, 128, 128);">16</span> <span style="color: rgb(0, 0, 0);">            M </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> Class.create(T, {<br /> </span><span style="color: rgb(0, 128, 128);">17</span> <span style="color: rgb(0, 0, 0);">                initialize : </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> (tt,mm,nn) {<br /> </span><span style="color: rgb(0, 128, 128);">18</span> <span style="color: rgb(0, 0, 0);">                    $super(tt,mm);<br /> </span><span style="color: rgb(0, 128, 128);">19</span> <span style="color: rgb(0, 0, 0);">                    alert(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">initialize M<img src="http://m.tkk7.com/Images/dot.gif" alt="" /></span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br /> </span><span style="color: rgb(0, 128, 128);">20</span> <span style="color: rgb(0, 0, 0);">                    </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.nn </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> nn;<br /> </span><span style="color: rgb(0, 128, 128);">21</span> <span style="color: rgb(0, 0, 0);">                },<br /> </span><span style="color: rgb(0, 128, 128);">22</span> <span style="color: rgb(0, 0, 0);">                f : </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> () {<br /> </span><span style="color: rgb(0, 128, 128);">23</span> <span style="color: rgb(0, 0, 0);">                    <span style="color: rgb(102, 255, 32);"><span style="color: rgb(0, 255, 15);"><span style="color: rgb(27, 216, 0);">//$super();  榪欓噷涔熷彲浠ヤ笉璋冪敤鐖剁被鐨刦鏂規硶</span></span></span><br /> </span><span style="color: rgb(0, 128, 128);">24</span> <span style="color: rgb(0, 0, 0);">                    alert(</span><span style="color: rgb(0, 0, 0);">456</span><span style="color: rgb(0, 0, 0);">);<br /> </span><span style="color: rgb(0, 128, 128);">25</span> <span style="color: rgb(0, 0, 0);">                },<br /> </span><span style="color: rgb(0, 128, 128);">26</span> <span style="color: rgb(0, 0, 0);">                s : </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> () {<br /> </span><span style="color: rgb(0, 128, 128);">27</span> <span style="color: rgb(0, 0, 0);">                    alert(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">sssss</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br /> </span><span style="color: rgb(0, 128, 128);">28</span> <span style="color: rgb(0, 0, 0);">                }<br /> </span><span style="color: rgb(0, 128, 128);">29</span> <span style="color: rgb(0, 0, 0);">            });<br /> </span><span style="color: rgb(0, 128, 128);">30</span> <span style="color: rgb(0, 0, 0);">            <br /> </span><span style="color: rgb(0, 128, 128);">31</span> <span style="color: rgb(0, 0, 0);">            N </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> Class.create(M);<br /> </span><span style="color: rgb(0, 128, 128);">32</span> <span style="color: rgb(0, 0, 0);">            <br /> </span><span style="color: rgb(0, 128, 128);">33</span> <span style="color: rgb(0, 0, 0);">            m </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> N(</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">);<br /> </span><span style="color: rgb(0, 128, 128);">34</span> <span style="color: rgb(0, 0, 0);">            m.f();<br /> </span><span style="color: rgb(0, 128, 128);">35</span> <span style="color: rgb(0, 0, 0);">            m.l();<br /> </span><span style="color: rgb(0, 128, 128);">36</span> <span style="color: rgb(0, 0, 0);">            m.s();<br /> </span><span style="color: rgb(0, 128, 128);">37</span> <span style="color: rgb(0, 0, 0);">            alert(m.tt);<br /> </span><span style="color: rgb(0, 128, 128);">38</span> <span style="color: rgb(0, 0, 0);">            alert(m.mm);<br /> </span><span style="color: rgb(0, 128, 128);">39</span> <span style="color: rgb(0, 0, 0);">            alert(m.nn);<br /> </span><span style="color: rgb(0, 128, 128);">40</span> <span style="color: rgb(0, 0, 0);">            alert(m </span><span style="color: rgb(0, 0, 255);">instanceof</span><span style="color: rgb(0, 0, 0);"> N);<br /> </span><span style="color: rgb(0, 128, 128);">41</span> <span style="color: rgb(0, 0, 0);">            alert(m </span><span style="color: rgb(0, 0, 255);">instanceof</span><span style="color: rgb(0, 0, 0);"> M);<br /> </span><span style="color: rgb(0, 128, 128);">42</span> <span style="color: rgb(0, 0, 0);">            alert(m </span><span style="color: rgb(0, 0, 255);">instanceof</span><span style="color: rgb(0, 0, 0);"> T);</span><span style="color: rgb(0, 128, 128);"><br /> </span></div> <br /> 鍦ㄥ仛鐨勮繃紼嬩腑錛屼笂闈㈢矖浣撻儴鍒嗕笉鏄儚鐜板湪榪欐牱瀹炵幇鐨勶紝閬囧埌浜嗕竴涓紓鐨勯棶棰橈紝涓嬮潰緇欏嚭鍘熸潵鐨勫疄鐜幫細<br /> <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 128, 128);">1</span> <span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> _parent </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> klazz.prototype[key];<br /> </span><span style="color: rgb(0, 128, 128);">2</span> <span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> _method </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> properties[key];<br /> </span><span style="color: rgb(0, 128, 128);">3</span> <span style="color: rgb(0, 0, 0);">klazz.prototype[key] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);">() {<br /> </span><span style="color: rgb(0, 128, 128);">4</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> _this </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);">5</span> <span style="color: rgb(0, 0, 0);">    $super </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);">(){<br /> </span><span style="color: rgb(0, 128, 128);">6</span> <span style="color: rgb(0, 0, 0);">         _parent.apply(_this, arguments);<br /> </span><span style="color: rgb(0, 128, 128);">7</span> <span style="color: rgb(0, 0, 0);">    }<br /> </span><span style="color: rgb(0, 128, 128);">8</span> <span style="color: rgb(0, 0, 0);">    _method.apply(</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">, arguments);<br /> </span><span style="color: rgb(0, 128, 128);">9</span> <span style="color: rgb(0, 0, 0);">}</span></div> 榪欑瀹炵幇閫犳垚浜唊lazz鐨刾rototype涓殑姣忎釜鏂規硶鎵ц鎬繪槸榪斿洖鐩稿悓緇撴灉錛屽師鍥犳槸_parent鍜宊method鍦╟reate涓涓狢lass鐨? 鏃跺欏凡緇忚鍥哄畾鍒皃roperties鐨勬渶鍚庝竴涓猭ey涓婏紝鎵浠ュ湪榪愯鐨勬椂鍊欎細榪斿洖鐩稿悓鐨勭粨鏋滐紝瑙e喅鏂規硶濡傚悓涓婇潰綺椾綋閮ㄥ垎錛屽繀欏葷敤涓涓嚱鏁板皝瑁呭茍绔嬪嵆鎵ц 榪斿洖鍐呴儴鍑芥暟錛岃繖鏄棴鍖呯殑涓縐嶄嬌鐢ㄦ柟寮忥紝榪欑鍋氭硶綾諱技鎶婂嚱鏁板唴鐨勫唴瀹瑰仛涓涓揩鐓э紝榪斿洖鐨勫唴閮ㄥ嚱鏁板瓨鍙栧彉閲忕殑鏃跺欏叾瀹炴槸浠庡揩鐓т腑鍙栧緱錛岃屼笉鏄粠 properties涓彇寰椼?br /> <br /> 榪欎釜鐗堟湰騫朵笉鑳界敤鍦ㄧ敓浜х幆澧冧腑錛岀敱浜庢椂闂翠粨淇冿紝鑲畾浼氭湁BUG鎴栦笉瀹屽杽鐨勫湴鏂廣傛墍浠ュ緩璁ぇ瀹惰繕鏄嬌鐢≒rototype鐨勫疄鐜幫紝鎴戣繖涓疄鐜板彧鏄敤鏉ユ洿鍔犳繁鍒葷殑鐞嗚В涓浜涙蹇碉紝姣斿鍙橀噺浣滅敤鍩熼摼銆侀棴鍖呯瓑絳夌殑浣跨敤銆?br /> <br /> </span> <img src ="http://m.tkk7.com/smcdl/aggbug/280773.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/smcdl/" target="_blank">teddy</a> 2009-06-09 00:04 <a href="http://m.tkk7.com/smcdl/archive/2009/06/09/280773.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>瀵笿avaScript鐨勫彉閲忎綔鐢ㄥ煙鐨勭悊瑙?/title><link>http://m.tkk7.com/smcdl/archive/2009/05/19/271421.html</link><dc:creator>teddy</dc:creator><author>teddy</author><pubDate>Mon, 18 May 2009 18:06:00 GMT</pubDate><guid>http://m.tkk7.com/smcdl/archive/2009/05/19/271421.html</guid><wfw:comment>http://m.tkk7.com/smcdl/comments/271421.html</wfw:comment><comments>http://m.tkk7.com/smcdl/archive/2009/05/19/271421.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/smcdl/comments/commentRss/271421.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/smcdl/services/trackbacks/271421.html</trackback:ping><description><![CDATA[<span style="font-size: 10pt;"> <p>浣滅敤鍩熸槸涓涓娊璞℃蹇碉紝鍦ㄦ祻瑙堝櫒鐨凧avaScript瀹炵幇涓細鏈夎繖涓蹇碉紝浣嗘槸涓嶅悓嫻忚鍣ㄥ疄鐜板彲鑳戒笉鍚屻?br /> <br /> 涓銆佷綔鐢ㄥ煙鐨勭綾伙紙鑷繁鎰熸偀錛?br /> 1.瀵硅薄浣滅敤鍩燂紝window鍙婃爣絳懼厓绱犻兘灞炰簬瀵硅薄浣滅敤鍩熴?br /> 2.鍑芥暟浣滅敤鍩燂紝鍑芥暟鑷韓褰㈡垚鐨勪綔鐢ㄥ煙銆?br /> 鍙互鎶婁綔鐢ㄥ煙鐪嬩綔鏄笂涓嬫枃錛坈ontext錛変箣綾葷殑瀵硅薄銆?br /> <br /> 鐪嬩笅闈㈢殑浠g爜<br /> 渚?</p> <div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; width: 98%; font-size: 13px;"><span style="color: #008080;"> 1</span><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: #0000ff;">breakE</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;">;<br /> </span><span style="color: #008080;"> 2</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff;">var</span><span style="color: #000000;"> state </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #000000;">1</span><span style="color: #000000;">;                </span><span style="color: #008000;">//</span><span style="color: #008000;">1</span><span style="color: #008000;"><br /> </span><span style="color: #008080;"> 3</span><span style="color: #008000;"><img id="Codehighlighter1_69_245_Open_Image" onclick="this.style.display='none'; Codehighlighter1_69_245_Open_Text.style.display='none'; Codehighlighter1_69_245_Closed_Image.style.display='inline'; Codehighlighter1_69_245_Closed_Text.style.display='inline';" alt="" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img style="display: none;" id="Codehighlighter1_69_245_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_69_245_Closed_Text.style.display='none'; Codehighlighter1_69_245_Open_Image.style.display='inline'; Codehighlighter1_69_245_Open_Text.style.display='inline';" alt="" src="http://m.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="color: #000000;">Person </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000ff;">function</span><span style="color: #000000;">(name) </span><span style="border: 1px solid #808080; background-color: #ffffff; display: none;" id="Codehighlighter1_69_245_Closed_Text"><img alt="" src="http://m.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_69_245_Open_Text"><span style="color: #000000;">{     </span><span style="color: #008000;">//</span><span style="color: #008000;">2</span><span style="color: #008000;"><br /> </span><span style="color: #008080;"> 4</span><span style="color: #008000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000;">    </span><span style="color: #0000ff;">var</span><span style="color: #000000;"> age </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #000000;">20</span><span style="color: #000000;">;<br /> </span><span style="color: #008080;"> 5</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="color: #0000ff;">this</span><span style="color: #000000;">.name </span><span style="color: #000000;">=</span><span style="color: #000000;"> name;<br /> </span><span style="color: #008080;"> 6</span><span style="color: #000000;"><img id="Codehighlighter1_147_229_Open_Image" onclick="this.style.display='none'; Codehighlighter1_147_229_Open_Text.style.display='none'; Codehighlighter1_147_229_Closed_Image.style.display='inline'; Codehighlighter1_147_229_Closed_Text.style.display='inline';" alt="" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img style="display: none;" id="Codehighlighter1_147_229_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_147_229_Closed_Text.style.display='none'; Codehighlighter1_147_229_Open_Image.style.display='inline'; Codehighlighter1_147_229_Open_Text.style.display='inline';" alt="" src="http://m.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span style="color: #0000ff;">this</span><span style="color: #000000;">.show </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000ff;">function</span><span style="color: #000000;"> () </span><span style="border: 1px solid #808080; background-color: #ffffff; display: none;" id="Codehighlighter1_147_229_Closed_Text"><img alt="" src="http://m.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_147_229_Open_Text"><span style="color: #000000;">{     </span><span style="color: #008000;">//</span><span style="color: #008000;">3</span><span style="color: #008000;"><br /> </span><span style="color: #008080;"> 7</span><span style="color: #008000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000;">        alert(age);<br /> </span><span style="color: #008080;"> 8</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />        alert(state);<br /> </span><span style="color: #008080;"> 9</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />        alert(name);<br />                alert(</span><span style="color: #0000ff;">this</span><span style="color: #000000;">.name);<br /> </span><span style="color: #008080;">10</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">11</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />    alert(m);<br /> </span><span style="color: #008080;">12</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">13    Person.prototype.check = function () {};</span><span style="color: #000000;"><br /> </span><span style="color: #008080;">14</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" />m </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000ff;">new</span><span style="color: #000000;"> Person('mike');       </span><span style="color: #008000;">//</span><span style="color: #008000;">4</span><span style="color: #008000;"><br /> </span><span style="color: #008080;">15</span><span style="color: #008000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" />var </span><span style="color: #000000;">j </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000ff;">new</span><span style="color: #000000;"> Person('Jerry');      </span><span style="color: #008000;">//</span><span style="color: #008000;">5</span><span style="color: #008000;"><br /> </span><span style="color: #008080;">16</span><span style="color: #008000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">17</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" />m.show();                     </span><span style="color: #008000;">//</span><span style="color: #008000;">6</span></div> 閫氳繃鐪嬩笂闈㈣繖孌典唬鐮佹垜浠彂鐜版湁鏃跺欏畾涔夊彉閲忔椂鐢╲ar錛屾湁鏃跺欏嵈涓嶇敤錛岃繖閲屾湁浠涔堝尯鍒悧錛熷湪姝や箣鍓嶆垜浠厛瀹氫笅瑙勭煩錛岄偅灝辨槸蹇呴』鏈変竴涓叏灞浣滅敤鍩燂紝灝卞儚鏄痺indow瀵硅薄鐨勫瓨鍦ㄤ竴鏍鳳紝鏄綔鐢ㄥ煙鐨勬渶欏跺眰銆傞偅涔堝摢浜涘彉閲忚瀹氫箟鍒頒綔鐢ㄥ煙鐨勬渶欏跺眰鍛紵閭e氨鏄痵tate錛屽浜庝笉鍦ㄤ換浣曞嚱鏁版垨綾諱腑鐢╲ar瀹氫箟鐨勫彉閲忓瓨鍦ㄤ簬鍏ㄥ眬浣滅敤鍩熶腑銆傞偅涔堝叏灞浣滅敤鍩熷睘浜庝綔鐢ㄥ煙鐨勫摢縐嶇被鍨嬪憿錛熼偅灝辨槸瀵硅薄浣滅敤鍩熴傚叿浣撴槸鍝釜瀵硅薄鐨勪綔鐢ㄥ煙鍛紵闈瀢indow瀵硅薄鑾睘銆?br /> <br /> 鎴戜滑鍙互鎶婂璞′綔鐢ㄥ煙鎯沖儚鎴愪袱閮ㄥ垎錛屽乏闈㈤儴鍒嗘槸瀵硅薄綰у埆鐨勶紝淇濆瓨鐨勬槸鍜屽璞$粦瀹氱殑鎴愬憳灞炴э紙鏃犺鏄彉閲忚繕鏄嚱鏁幫級錛岄氳繃this鏉ヨ闂殑銆傚彸闈㈢殑閮ㄥ垎鏄綔鐢ㄥ煙綰у埆鐨勶紝淇濆瓨鐨勬槸var瀹氫箟鐨勫睘鎬э紙鏃犺鏄彉閲忚繕鏄嚱鏁幫級錛屽彲浠ョ洿鎺ラ氳繃鍙橀噺鍚嶇О璁塊棶銆傚浜巜indow鏉ヨ瀹冩槸涓壒孌婁綋錛屼粠鐢╲ar瀹氫箟鐨勫彉閲忓彲浠ョ敤this鏉ヨ闂氨鑳界湅鍑洪棶棰橈紝鎴戜釜浜虹寽嫻媤indow瀵硅薄鏃㈡槸JavaScript鐨勯《灞傚璞″張鏄《灞備綔鐢ㄥ煙錛屾墍浠ユ墠浼氭湁榪欑鏁堟灉銆?br /> 鍙︿竴縐嶆儏鍐靛氨鏄爣絳懼厓绱犵殑瀵硅薄浣滅敤鍩熷拰鍏ㄥ眬浣滅敤鍩熼潪甯哥殑鍍忥紝濡備笅渚嬶細<br /> <div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; width: 98%; font-size: 13px;"><span style="color: #008080;"> 1</span><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: #008000;">//</span><span style="color: #008000;">渚?</span><span style="color: #008000;"><br /> </span><span style="color: #008080;"> 2</span><span style="color: #008000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #000000;"><</span><span style="color: #000000;">input type</span><span style="color: #000000;">=</span><span style="color: #000000;">'button' value</span><span style="color: #000000;">=</span><span style="color: #000000;">'click me' onclick</span><span style="color: #000000;">=</span><span style="color: #000000;">'alert(value)'</span><span style="color: #000000;">/></span><span style="color: #000000;"><br /> </span><span style="color: #008080;"> 3</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #008000;">//</span><span style="color: #008000;">渚?</span><span style="color: #008000;"><br /> </span><span style="color: #008080;"> 4</span><span style="color: #008000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #000000;"><</span><span style="color: #000000;">input type</span><span style="color: #000000;">=</span><span style="color: #000000;">'button' value</span><span style="color: #000000;">=</span><span style="color: #000000;">'click me' onclick</span><span style="color: #000000;">=</span><span style="color: #000000;">'alert(</span><span style="color: #0000ff;">this</span><span style="color: #000000;">.value)'</span><span style="color: #000000;">/></span><span style="color: #000000;"><br /> </span><span style="color: #008080;"> 5</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #008000;">//</span><span style="color: #008000;">渚?</span><span style="color: #008000;"><br /> </span><span style="color: #008080;"> 6</span><span style="color: #008000;"><img id="Codehighlighter1_162_205_Open_Image" onclick="this.style.display='none'; Codehighlighter1_162_205_Open_Text.style.display='none'; Codehighlighter1_162_205_Closed_Image.style.display='inline'; Codehighlighter1_162_205_Closed_Text.style.display='inline';" alt="" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img style="display: none;" id="Codehighlighter1_162_205_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_162_205_Closed_Text.style.display='none'; Codehighlighter1_162_205_Open_Image.style.display='inline'; Codehighlighter1_162_205_Open_Text.style.display='inline';" alt="" src="http://m.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="color: #0000ff;">function</span><span style="color: #000000;"> test() </span><span style="border: 1px solid #808080; background-color: #ffffff; display: none;" id="Codehighlighter1_162_205_Closed_Text"><img alt="" src="http://m.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_162_205_Open_Text"><span style="color: #000000;">{<br /> </span><span style="color: #008080;"> 7</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />    alert(value);<br /> </span><span style="color: #008080;"> 8</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />    alert(</span><span style="color: #0000ff;">this</span><span style="color: #000000;">.value);<br /> </span><span style="color: #008080;"> 9</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">10</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #000000;"><</span><span style="color: #000000;">input type</span><span style="color: #000000;">=</span><span style="color: #000000;">'button' value</span><span style="color: #000000;">=</span><span style="color: #000000;">'click me' onclick</span><span style="color: #000000;">=</span><span style="color: #000000;">'test()'</span><span style="color: #000000;">/></span></div> 寰堝鎬負浠涔堜緥1鍜屼緥2璁塊棶value鍜屽叏灞浣滅敤鍩熼噷鐨剉ar瀹氫箟鐨勫彉閲忕殑琛屼負鏄竴鑷寸殑錛屾寜鐞嗚value搴旇灞炰簬input鏍囩鍏冪礌瀵硅薄鐨勬垚鍛樺睘鎬э紝璁塊棶瀵硅薄鐨勬垚鍛樺睘鎬у簲璇ョ敤this鏉ヨ闂紝鎴戜滑鑷畾涔夌殑綾伙紝濡傛灉鎴愬憳鏂規硶鎯寵闂垚鍛樺彉閲忛兘闇瑕佸姞this鐨勶紝灝卞儚鏈涓婇潰鐨勪緥瀛愰噷鐨則his.show鏂規硶璁塊棶this.name鎴愬憳鍙橀噺涓鏍楓傝屽浜庝緥3錛屽嫟蹇殑璇昏呭鏋滆繍琛屼竴涓嬩究鐭ヤ竴瀹氫細鍑洪敊鐨勶紝絎竴鍙ョ郴緇熶細鎶alue鏈畾涔夛紙闄ら潪浣犲湪鍏ㄥ眬浣滅敤鍩熷畾涔夎繃value鍙橀噺錛夛紝絎簩鍙ヤ細鎵撳嵃鍑簎ndefined銆備負浠涔堜細榪欐牱鍛紵榪欏氨瑕佸紩鍑轟綔鐢ㄥ煙閾捐繖涓蹇典簡錛屽悗闈細瑙i噴榪欎釜姒傚康鐨勩?br /> <br /> 鍙嶈鍑芥暟浣滅敤鍩燂紝鐢變簬鍑芥暟涓敤var瀹氫箟鐨勫彉閲忎笉鑳界敤this鏉ヨ闂紝鎵浠ュ湪鍑芥暟浣滅敤鍩熶腑涓嶅啀鍍忓璞′綔鐢ㄥ煙閭f牱鍒嗕袱閮ㄥ垎錛岃宼his瀹為檯淇濆瓨鐨勬槸涓庤鍑芥暟緇戝畾鐨勫璞$殑寮曠敤錛屼篃灝辨槸璇磘his鍦ㄥ嚱鏁頒腑鏈夌壒孌婄殑鍚箟錛屾槸涓嶈兘鎸綔瀹冪敤鐨勩?br /> <br /> 浜屻佷綔鐢ㄥ煙閾?br /> 浣滅敤鍩熸槸鍙互宓屽鐨勶紝鑰屽祵濂楃殑緇撴灉灝卞艦鎴愪簡浣滅敤鍩熼摼錛屽渚?鎵紺猴紝鎴戜滑鏉ユ弿榪頒竴涓嬩綔鐢ㄥ煙閾撅細<br /> 鍏ㄥ眬浣滅敤鍩?lt;----Person鍑芥暟浣滅敤鍩?lt;-----show鍑芥暟浣滅敤鍩?br /> 鍦ㄥ叏灞浣滅敤鍩熶腑鍙互璁塊棶鍝簺鍙橀噺鍛紙娉ㄦ剰鎴戠幇鍦ㄦ寚鐨勫彧鏄綔鐢ㄥ煙涓殑鍙橀噺錛夛紵<br /> 1.state<br /> 2.j<br /> 鍦≒erson鍑芥暟浣滅敤鍩熶腑鍙互璁塊棶鍝簺鍙橀噺鍛紵<br /> 1.鍏ㄥ眬浣滅敤鍩熶腑鐨勬墍鏈夊彲璁塊棶鐨勫彉閲?br /> 2.name錛堝弬鏁幫級<br /> 3.age<br /> 鍦╯how鍑芥暟涓張鏈夊摢浜涘彉閲忓彲浠ヨ璁塊棶鍛紵<br /> 1.鍏ㄥ眬浣滅敤鍩熶腑鐨勬墍鏈夊彲璁塊棶鍙橀噺<br /> 2.Person鍑芥暟浣滅敤鍩熶腑鎵鏈夊彲璁塊棶鍙橀噺<br /> 3.濡傝嫢show鍑芥暟涓繕瀹氫箟浜唙ar鍙橀噺涔熻鍔犲叆show鍑芥暟浣滅敤鍩?br /> <br /> 濡傛灉鍦╯how涓闂竴涓獂鍙橀噺錛岄鍏堜粠show鍑芥暟浣滅敤鍩熼噷鏌ユ槸鍚︽湁x榪欎釜鍙橀噺錛屽鏋滄病鏈夊啀鏌erson浣滅敤鍩燂紝濡傛灉榪樻病鏈夌殑璇濆啀鏌ュ叏灞浣滅敤鍩燂紝鎵懼埌灝辮繑鍥炶鍙橀噺銆?br /> 璁茶В鍒拌繖閲屾垜浠彂鐜頒竴涓棶棰橈紝浼間箮浣滅敤鍩熸槸瀹氫箟鏃剁敓鎴愬潡綰т綔鐢ㄥ煙錛堝嵆鍗曠嫭鐨勫璞′綔鐢ㄥ煙鍜屽嚱鏁頒綔鐢ㄥ煙錛夎岃繍琛屾椂鐢熸垚浣滅敤鍩熼摼錛岃繖灝辨槸璇嶆硶浣滅敤鍩熺殑鐢辨潵銆傛湁浜嗚繖縐嶄綔鐢ㄥ煙灝辨瀯鎴愪簡闂寘鐨勫熀紜銆?br /> 涓嬮潰鏄竴涓◢寰壒孌婄殑渚嬪瓙錛?br /> </span> <div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #008080;"> 1</span> <span style="color: #0000ff;">function</span><span style="color: #000000;"> test() {<br /> </span><span style="color: #008080;"> 2</span> <span style="color: #000000;">    test2();<br /> </span><span style="color: #008080;"> 3</span> <span style="color: #000000;">}<br /> </span><span style="color: #008080;"> 4</span> <span style="color: #000000;"><br /> </span><span style="color: #008080;"> 5</span> <span style="color: #0000ff;">function</span><span style="color: #000000;"> test3() {<br /> </span><span style="color: #008080;"> 6</span> <span style="color: #000000;">    test2 </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000ff;">function</span><span style="color: #000000;">() {<br /> </span><span style="color: #008080;"> 7</span> <span style="color: #000000;">        alert(</span><span style="color: #000000;">"</span><span style="color: #000000;">test2</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br /> </span><span style="color: #008080;"> 8</span> <span style="color: #000000;">    }<br /> </span><span style="color: #008080;"> 9</span> <span style="color: #000000;">    test();<br /> </span><span style="color: #008080;">10</span> <span style="color: #000000;">}</span></div> <span style="font-size: 10pt;">瀹氫箟test鐨勬椂鍊檛est2榪樹笉瀛樺湪錛屼絾鏄皟鐢╰est鐨勬椂鍊欙紝test2灝卞瓨鍦ㄤ簡錛岃繖璇存槑浜嗕綔鐢ㄥ煙閾劇‘瀹炴槸榪愯鏃剁敓鎴愮殑銆?/span><br /> <br /> <span style="font-size: 10pt;"> 閫氳繃浣滅敤鍩熼摼濡備綍瑙i噴渚?銆?銆?鍛紵<br /> 鎴戠殑鍒嗘瀽鏄浜嶩TML鍏冪礌鏉ヨ褰撻〉闈㈣В鏋愮殑鏃跺欙紝鍏冪礌琚В鏋愭垚DOM鏍戯紝HTML鍏冪礌閲岀殑鏍囧噯灞炴т綔涓鴻鍏冪礌瀵硅薄浣滅敤鍩熺殑鍙橀噺錛堢被浼紇ar瀹氫箟鐨勯偅縐嶏級錛岃岄潪璇ュ厓绱燚OM瀵硅薄鐨勬垚鍛樺睘鎬э紙綾諱技this瀹氫箟鐨勯偅縐嶏級錛岃繖鏍峰氨瑙i噴浜嗕袱涓棶棰橈細<br /> 1.鍦ㄩ〉闈笂棰勫畾涔夌殑HTML鍏冪礌鏍囧噯灞炴ф槸涓嶈兘鐢╠elete鍜宺emoveAttribute鍒犻櫎鐨勩?br /> 2.onclick灞炰簬input鍏冪礌鐨勪竴涓柟娉曪紝閭d箞榪欎釜浣滅敤鍩熼摼搴旇鍍忎笅闈㈣繖鏍鳳細<br />    鍏ㄥ眬浣滅敤鍩?lt;-----HTML鍏冪礌浣滅敤鍩?lt;-------onclick鍑芥暟浣滅敤鍩?br />    value鍙橀噺鍦ㄥ摢涓綔鐢ㄥ煙閲屽憿錛熺瓟妗堟槸HTML鍏冪礌浣滅敤鍩熶腑銆傛墍浠nclick涓嶄絾鍙互璁塊棶鑰屼笖鍔犱笉鍔爐his閮藉彲浠ャ?br /> 閭d箞渚?鐨勪綔鐢ㄥ煙閾炬槸浠涔堟牱鐨勫憿錛熷涓嬶細<br />     鍏ㄥ眬浣滅敤鍩?lt;-----test鍑芥暟浣滅敤鍩?br />     鍏ㄥ眬浣滅敤鍩?lt;-----HTML鍏冪礌浣滅敤鍩?lt;-------onclick鍑芥暟浣滅敤鍩?br /> 娌¢敊鏄袱鏉★紝鍥犱負褰撳崟鍑繪寜閽悗鎵ц鍒皁nclick鍑芥暟涓椂璧扮殑鏄浜屾潯閾撅紝鑰屽湪onclick涓皟鐢ㄤ簡test鍑芥暟鏃訛紝璧扮殑鏄涓鏉¢摼銆?br /> 鏄劇劧value榪樻槸瀹氫箟鍦℉TML鍏冪礌浣滅敤鍩熶腑錛岃宼est鎯寵闂畍alue鍊間竴瀹氭槸璁塊棶涓嶅埌鐨勩?br /> <br /> 瀵逛簬榪欎釜闂鎴戣繕嫻嬭瘯浜嗕竴涓嬮潪鏍囧噯灞炴э紝濡備笅渚嬶細<br /> <div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; width: 98%; font-size: 13px;"><span style="color: #008080;">1</span><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: #000000;"><</span><span style="color: #000000;">input type</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">button</span><span style="color: #000000;">"</span><span style="color: #000000;"> value</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">click me</span><span style="color: #000000;">"</span><span style="color: #000000;"> bb</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">123</span><span style="color: #000000;">"</span><span style="color: #000000;"> onclick</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">delete this.bb; alert(bb)</span><span style="color: #000000;">"</span><span style="color: #000000;">/></span></div> 嫻嬭瘯鍙戠幇闈炴爣鍑嗙殑HTML鍏冪礌灞炴у彲浠ヨ鍒犻櫎錛屼絾鏄痙elete璇彞鎵ц鏃跺繀欏葷敤this鏉ュ紩鐢紙IE涓祴璇曪級錛岀洿鎺ヨ闂alert鍒版病鏈夎繖涓檺鍒躲?br /> 璇存槑bb鏄痠nput瀵硅薄灞炴ф槸娌¢敊鐨勶紝鍥犱負瀹冨彲浠ヨ鍒犻櫎錛屼絾鏄鏋滃畠娌℃湁琚垹闄ょ殑璇漚lert(bb)榪樻槸鑳芥樉紺哄嚭鏉ョ殑錛岃鏄庤繖綾誨睘鎬у緢鐗規畩錛屽叿浣撴庝箞瑙i噴鎴戣繕娌℃湁鎯沖ソ錛屽鏋滄湁鏈嬪弸鑳借В閲婄殑閫氾紝璇峰憡鐭ユ垜銆?br /> <br /> 涓夈佷粈涔堟槸闂寘<br /> show鍑芥暟鏄劇劧鏄竴涓棴鍖咃紝浣嗘槸瀹冩槸鐢辯被鐨勬瀯閫犲嚱鏁扮敓鎴愮殑錛屽拰鍙︿竴縐嶅艦寮忓叾瀹炴槸涓鏍風殑錛屼唬鐮佸涓嬶細<br /> <div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; width: 98%; font-size: 13px;"><span style="color: #008080;"> 1</span><img id="Codehighlighter1_24_80_Open_Image" onclick="this.style.display='none'; Codehighlighter1_24_80_Open_Text.style.display='none'; Codehighlighter1_24_80_Closed_Image.style.display='inline'; Codehighlighter1_24_80_Closed_Text.style.display='inline';" alt="" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img style="display: none;" id="Codehighlighter1_24_80_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_24_80_Closed_Text.style.display='none'; Codehighlighter1_24_80_Open_Image.style.display='inline'; Codehighlighter1_24_80_Open_Text.style.display='inline';" alt="" src="http://m.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /><span style="color: #0000ff;">function</span><span style="color: #000000;"> getFunc (a, b) </span><span style="border: 1px solid #808080; background-color: #ffffff; display: none;" id="Codehighlighter1_24_80_Closed_Text"><img alt="" src="http://m.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_24_80_Open_Text"><span style="color: #000000;">{<br /> </span><span style="color: #008080;"> 2</span><span style="color: #000000;"><img id="Codehighlighter1_49_78_Open_Image" onclick="this.style.display='none'; Codehighlighter1_49_78_Open_Text.style.display='none'; Codehighlighter1_49_78_Closed_Image.style.display='inline'; Codehighlighter1_49_78_Closed_Text.style.display='inline';" alt="" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img style="display: none;" id="Codehighlighter1_49_78_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_49_78_Closed_Text.style.display='none'; Codehighlighter1_49_78_Open_Image.style.display='inline'; Codehighlighter1_49_78_Open_Text.style.display='inline';" alt="" src="http://m.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> </span><span style="color: #0000ff;">function</span><span style="color: #000000;"> () </span><span style="border: 1px solid #808080; background-color: #ffffff; display: none;" id="Codehighlighter1_49_78_Closed_Text"><img alt="" src="http://m.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_49_78_Open_Text"><span style="color: #000000;">{<br /> </span><span style="color: #008080;"> 3</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />         alert(a </span><span style="color: #000000;">-</span><span style="color: #000000;"> b);<br /> </span><span style="color: #008080;"> 4</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="color: #000000;"><br /> </span><span style="color: #008080;"> 5</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="color: #000000;"> <br /> </span><span style="color: #008080;"> 6</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><br /> </span><span style="color: #008080;"> 7</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff;">var</span><span style="color: #000000;"> func1 </span><span style="color: #000000;">=</span><span style="color: #000000;"> getFunc(</span><span style="color: #000000;">10</span><span style="color: #000000;">,</span><span style="color: #000000;">5</span><span style="color: #000000;">);<br /> </span><span style="color: #008080;"> 8</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" />func1();<br /> </span><span style="color: #008080;"> 9</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><br /> </span><span style="color: #008080;">10</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff;">var</span><span style="color: #000000;"> func2 </span><span style="color: #000000;">=</span><span style="color: #000000;"> getFunc(</span><span style="color: #000000;">20</span><span style="color: #000000;">,</span><span style="color: #000000;">30</span><span style="color: #000000;">);<br /> </span><span style="color: #008080;">11</span><span style="color: #000000;"><img alt="" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" />func2();</span></div> 涓婇潰鐨勪唬鐮乫unc1鍑芥暟鏃犺鎴戞墽琛屽灝戞閮芥樉紺?錛宖unc2鍑芥暟鏃犺鎴戞墽琛屽灝戞閮芥樉紺?10錛岃繖鍜屼緥0鏄涔堢殑鍍忓憖錛屼緥0涓璵.show()鏃犺鎵ц澶氬皯嬈¢兘鑳芥樉紺?mike'錛宩.show()鏃犺鎵ц澶氬皯嬈¢兘鑳芥樉紺?Jerry'錛堣鍙?閭h鍦ㄨ搗浣滅敤錛屽厛涓嶈冭檻this.name閭h錛夈傝繖灝辨槸闂寘錛屾妸浣滅敤鍩熼摼涓彉鍖栫殑鍙橀噺緇欏浐瀹氬寲錛岀劧鍚庢妸浣滅敤鍩熼摼鍜屽嚱鏁版湰韜繘琛岀粦瀹氾紝鏃犺鎴戝湪浠涔堝湴鏂規墽琛屽嚱鏁幫紝鍑芥暟鐨勪綔鐢ㄥ煙閾懼緇堟槸瀹冨畾涔夌殑鏃跺欓偅鏉°?br /> <br /> 鍥涖佸叧浜庡璞℃垚鍛樼殑璁塊棶錛堝嵆this鑳藉紩鐢ㄧ殑閭d簺灞炴э級錛屾垜鍙槸鍦ㄧ寽鎯籌紝鍙兘鐨勪綔鐢ㄥ煙閾懼簲璇ュ涓嬶細<br />     鍏ㄥ眬浣滅敤鍩?lt;-------m瀵硅薄浣滅敤鍩?lt;-------m.test鍑芥暟浣滅敤鍩?br />     m鐨勫璞℃垚鍛橈紙綾諱腑this瀹氫箟鐨勶級淇濆瓨鍦ㄥ璞′綔鐢ㄥ煙鐨勫乏鍗婇儴錛宮鐨勪綔鐢ㄥ煙鍙橀噺錛堢被涓璿ar瀹氫箟鐨勶級淇濆瓨鍦ㄥ璞′綔鐢ㄥ煙鐨勫彸鍗婇儴銆?br />     m.test鍑芥暟瑕佽闂璞℃垚鍛樻椂浠庡璞′綔鐢ㄥ煙鐨勫乏鍗婇儴媯绱紝瑕佽闂綔鐢ㄥ煙鍙橀噺鏃朵粠瀵硅薄浣滅敤鍩熺殑鍙沖崐閮ㄦ绱€?br />     鍚屾椂榪欎釜浣滅敤鍩熼摼榪樿В絳斾簡鍙︿竴涓棶棰橈紝鍗沖師鍨嬫柟娉曪紙鍏叡鏂規硶錛変負浠涔堜笉鑳借闂被涓敤var瀹氫箟鐨勫彉閲忋?br />     鐪嬩緥0鍗沖彲鐭heck鍜孭erson鏍規湰灝變笉鍦ㄥ悓涓涓摼涓婏紝鍙堣皥浣曡兘璁塊棶鍛紵<br /> <br /> 鑷蟲鎶奐avaScript鍙橀噺浣滅敤鍩熻瑙e畬姣曪紝鎴戣寰楄繖涓繕鏄洰閲嶈鐨勶紝濡傛灉涓瀹氳鏈変釜姣旇緝鐨勮瘽錛屽簲璇ュ拰Java涓殑ClassLoader鏈夊悓鏍風殑閲嶈鎬у惂銆傚ぇ瀹跺熼壌鐨勫悓鏃惰澶氱粰鎴戞寚鍑洪敊璇紝鍥犱負榪欏叾涓湁涓浜涜繕鏄垜鐨勭寽嫻嬨? </span> <img src ="http://m.tkk7.com/smcdl/aggbug/271421.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/smcdl/" target="_blank">teddy</a> 2009-05-19 02:06 <a href="http://m.tkk7.com/smcdl/archive/2009/05/19/271421.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>IE document compatModehttp://m.tkk7.com/smcdl/archive/2009/04/15/265802.htmlteddyteddyWed, 15 Apr 2009 09:37:00 GMThttp://m.tkk7.com/smcdl/archive/2009/04/15/265802.htmlhttp://m.tkk7.com/smcdl/comments/265802.htmlhttp://m.tkk7.com/smcdl/archive/2009/04/15/265802.html#Feedback0http://m.tkk7.com/smcdl/comments/commentRss/265802.htmlhttp://m.tkk7.com/smcdl/services/trackbacks/265802.htmlcompatMode Property

Gets a value that indicates whether standards-compliant mode is switched on for the object.

Syntax

 [ sMode = ] object.compatMode

Possible Values

sMode String that receives one of the following values.
BackCompatStandards-compliant mode is not switched on.
CSS1CompatStandards-compliant mode is switched on.

The property is read-only. The property has no default value.

Remarks

With Microsoft Internet Explorer 6 and later, you switch on standards-compliant mode by including the !DOCTYPE declaration at the top of your document, specifying a valid Label in the declaration, and in some cases, specifying the Definition or URL. The Label element specifies the unique name of the Document Type Definition (DTD), and can be appended with the version number of the DTD. The Definition element specifies the definition of the DTD that is specified in the Label. The URL element specifies the location of the DTD.

When standards-compliant mode is switched on (also called "strict mode"), Windows Internet Explorer displays the document according to the World Wide Web Consortium (W3C) Cascading Style Sheets (CSS) World Wide Web link standard. When standards-compliant mode is not switched on (also called "quirks mode"), the document is displayed as it was displayed in previous versions of Internet Explorer.

 New for Internet Explorer 8 The compatMode property is deprecated in Internet Explorer 8 in favor of the documentMode property.




IE8 documentMode

Syntax

[ vMode = ] object.documentMode

Possible Values

vMode Floating-point that receives one of the following values.
5Microsoft Internet Explorer 5 mode (also known as "quirks mode").
7Internet Explorer 7 Standards mode.
8Internet Explorer 8 Standards mode.

The property is read-only. The property has no default value.

Remarks

This property is available in all compatibility modes.

The document compatibility mode of a Web page determines how Internet Explorer 8 interprets and renders the page. Page authors generally use meta elements to specify X-UA-Compatible HTTP-EQUIV headers that specify the document compatibility mode. For more information, see Defining Document Compatibility. In versions of Internet Explorer previous to Internet Explorer 8, compatMode was solely determined by DOCTYPE.



teddy 2009-04-15 17:37 鍙戣〃璇勮
]]>
JavaScript瀵筬orm鍙奻orm涓殑寮曠敤銆?/title><link>http://m.tkk7.com/smcdl/archive/2009/03/19/260892.html</link><dc:creator>teddy</dc:creator><author>teddy</author><pubDate>Thu, 19 Mar 2009 12:44:00 GMT</pubDate><guid>http://m.tkk7.com/smcdl/archive/2009/03/19/260892.html</guid><wfw:comment>http://m.tkk7.com/smcdl/comments/260892.html</wfw:comment><comments>http://m.tkk7.com/smcdl/archive/2009/03/19/260892.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://m.tkk7.com/smcdl/comments/commentRss/260892.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/smcdl/services/trackbacks/260892.html</trackback:ping><description><![CDATA[閫氬父鎴戜滑瀵筬orm鐨勫紩鐢ㄩ氳繃緇檉orm鍔犱笂id鏉ュ疄鐜幫紝鍏跺疄鎴戜滑鍙互浣跨敤name鏉ュ疄鐜般備袱鑰呯殑涓嶅悓鏄痠d闇瑕佺敤document.getElementById()鏉ユ绱紝name閫氳繃document.forms[form_name]鏉ユ绱紝鍦╢orm涓殑琛ㄥ崟鍏冪礌閮芥湁name鐨勬椂鍊欏彲浠ラ氳繃document.forms[form_name][element_name]鏉ユ绱㈠埌鎸囧畾鐨勮〃鍗曞厓绱犮傚彟涓縐嶆柟娉曞彲浠ラ氳繃document.forms[form_name].elements鏉ヨ幏寰楄〃鍗曞厓绱犵殑闆嗗悎錛屼絾鏄叾涓笉鍖呮嫭input type='image'錛屾墍鏈夎繖浜涙柟娉曞湪IE7銆丱pera銆丗F2銆丗F3銆丆hrome銆丼afari涓婃祴璇曢氳繃銆?br /> <br /> <img src ="http://m.tkk7.com/smcdl/aggbug/260892.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/smcdl/" target="_blank">teddy</a> 2009-03-19 20:44 <a href="http://m.tkk7.com/smcdl/archive/2009/03/19/260892.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>JavaScript娉ㄦ剰浜嬮」錛堜笉瀹氭湡鏇存柊錛?/title><link>http://m.tkk7.com/smcdl/archive/2009/01/19/251838.html</link><dc:creator>teddy</dc:creator><author>teddy</author><pubDate>Mon, 19 Jan 2009 02:42:00 GMT</pubDate><guid>http://m.tkk7.com/smcdl/archive/2009/01/19/251838.html</guid><wfw:comment>http://m.tkk7.com/smcdl/comments/251838.html</wfw:comment><comments>http://m.tkk7.com/smcdl/archive/2009/01/19/251838.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/smcdl/comments/commentRss/251838.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/smcdl/services/trackbacks/251838.html</trackback:ping><description><![CDATA[<strong>   鏈創灝嗕笉瀹氭湡鏇存柊錛屽皢闆嗗悎JavaScript浣跨敤涓父瑙佺殑闂銆?/strong><br />   <strong>綰﹀畾錛氭祻瑙堝櫒鍚嶇ОIE/FF(閫氭寚Windows騫沖彴涓婄殑IE銆丗F)銆両E5.5+/FF2+(鍚庨潰鐨勬暟瀛楄〃紺虹増鏈紝鐢氳嚦鍙互鏈夋洿璇︾粏鐨勭増鏈俊鎭級<br />   鐩墠鍙祴璇旾E鍜孎F錛屽叾浠栨祻瑙堝櫒涓嶅湪嫻嬭瘯鑼冨洿鍐咃紝濡傛灉鎴戝彧鎻愬強IE鐨勶紝鍒欒鏄庡湪IE涓湁闂錛岃屽湪FF涓病鏈夐棶棰樸?br /> </strong> <ol> <li>IE涓瑿lass涓嶈兘璺ㄧ獥鍙e紩鐢紝鍗沖湪鐖剁獥鍙e畾涔夌殑SomeClass涓嶈兘鍦ㄥ瓙紿楀彛涓疄渚嬪寲,濡?strong><span style="color: #ff0000">new opener.SomeClass()</span></strong><span style="color: #ff0000"><span style="color: #000000"><span style="color: #ff0000"><span style="color: #000000">銆傝娉ㄦ剰鍦ㄨ繖閲屾垜娌℃湁鎻愬埌frame鐨勬儏鍐碉紝鍥犱負鎴戣繕娌℃湁鏃墮棿嫻嬭瘯錛屽鏋滃摢浣嶆湁鏃墮棿嫻嬭瘯璇峰憡璇夋垜緇撴灉銆?/span></span></span></span><br /> <li>IE涓璬elete鎿嶄綔鍙兘鍒犻櫎JavaScript鎴栬嚜瀹氫箟瀵硅薄鐨勫睘鎬э紝鑰屼笉鑳藉垹闄TML Element瀵硅薄鐨勫睘鎬э紝濡傛灉鎯沖垹闄lement鐨勫睘鎬э紝璇蜂嬌鐢?strong><span style="color: #ff0000">removeAttribute()</span></strong>鏂規硶銆? <li>IE涓璬elete鎿嶄綔鍙兘鍒犻櫎闈瀡ar瀹氫箟鐨勫彉閲忋?nbsp; <li>IE涓鏋滃湪涓涓獥鍙e紩鐢ㄤ竴涓璞★紝濡傛灉榪欎釜瀵硅薄鏄湪鍏朵粬紿楀彛寤虹珛鐨勶紝浣嗘槸閭d釜紿楀彛宸茬粡鍏抽棴浜嗭紝閭d箞瀵硅繖涓璞$殑寮曠敤灝嗕細鍑洪敊銆?</li> </ol>           濡傚湪紿楀彛A涓?br />           opener.someClassObj = new SomeClass();<br />           window.close();<br />           紿楀彛B涓?br />           typeof someClassObj 緇撴灉鏄?'object'錛?浣嗘槸瀹為檯寮曠敤璇ュ璞″嵈浼氬嚭閿欍?br />          <br /> <br /> <img src ="http://m.tkk7.com/smcdl/aggbug/251838.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/smcdl/" target="_blank">teddy</a> 2009-01-19 10:42 <a href="http://m.tkk7.com/smcdl/archive/2009/01/19/251838.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍦ㄥ畾涔変竴涓猨s綾葷殑鏃跺欙紝涓轟粈涔堣璁劇疆璇ョ被鐨刾rototype灞炴т負瀹冩墍瑕佺戶鎵跨殑綾葷殑瀹炰緥瀵硅薄http://m.tkk7.com/smcdl/archive/2008/12/05/244594.htmlteddyteddyFri, 05 Dec 2008 06:24:00 GMThttp://m.tkk7.com/smcdl/archive/2008/12/05/244594.htmlhttp://m.tkk7.com/smcdl/comments/244594.htmlhttp://m.tkk7.com/smcdl/archive/2008/12/05/244594.html#Feedback0http://m.tkk7.com/smcdl/comments/commentRss/244594.htmlhttp://m.tkk7.com/smcdl/services/trackbacks/244594.html function A() {}
function B() {}
B.prototype = new A()

涓婇潰榪欐牱鍐欐槸涓轟簡璁﹊nstanceof璇彞鑳借搗浣滅敤銆備婦涓緥瀛愶細
1.涓嶉噸鍐欏瓙綾葷殑prototype灞炴?br /> b = new B();
b instanceof B  //return true
b instanceof A // return false
b instanceof Object //return true

2.鍐欏瓙綾葷殑prototype灞炴?br /> b = new B();
b instanceof B //return true
b instanceof A //return true
b instanceof Object //return true

鍙﹀錛宲rototype鐨勪綔鐢ㄦ槸鍙互鐢ㄦ潵妯℃嫙緇ф壙錛屼嬌鎴戜滑鍦ㄧ埗綾婚噷娣誨姞鐨勫睘鎬ф柟娉曞湪瀛愮被閲岃兘璁塊棶銆?br /> 浣嗘槸鎴戜滑鍙互浣跨敤涓縐嶅叾浠栫殑鏂規硶鏉ュ彉閫氥?br />
function A(x) {
    this.x = x;
    this.method1 = functioni () {};
}

function B(x,y) {
    A.call(this,x);
    this.y = y;
}

b  =  new B(1, 2)

榪欐椂b涓粷瀵規湁x錛屽茍涓攛 絳変簬1錛屼絾鏄垜浠負浠涔堣繕瑕佷嬌鐢╬rototype鍛紵
涓昏鏄負浜嗗悜鐖剁被鍘熷瀷鍔ㄦ佹坊鍔犵殑灞炴у拰鏂規硶鍙互鍑虹幇鍦ㄥ瓙綾葷殑瀹炰緥瀵硅薄涓?br /> 鎺ョ潃涓婇潰鐨勪緥瀛?br />
A.prototype.z = function () {}

濡傛灉鎴戜滑娌℃湁璁劇疆B.prototype = new A()錛屽垯b涓嶄細鍔ㄦ佹坊鍔犳柟娉晍 銆?br />


teddy 2008-12-05 14:24 鍙戣〃璇勮
]]>
JavaScript 綾誨瀷杞崲娉ㄦ剰浜嬮」http://m.tkk7.com/smcdl/archive/2008/11/14/240447.htmlteddyteddyFri, 14 Nov 2008 01:32:00 GMThttp://m.tkk7.com/smcdl/archive/2008/11/14/240447.htmlhttp://m.tkk7.com/smcdl/comments/240447.htmlhttp://m.tkk7.com/smcdl/archive/2008/11/14/240447.html#Feedback1http://m.tkk7.com/smcdl/comments/commentRss/240447.htmlhttp://m.tkk7.com/smcdl/services/trackbacks/240447.htmlJavaScript: The Definitive Guide, 5th Edition銆?br />
瀛楃鍨嬭漿鎹負鏁板煎瀷鍙互浣跨敤涓嬪垪鏂規硶
parseInt(stringVar);     //parseInt榪樺彲浠ユ寚瀹氫簩榪涘埗銆佸叓榪涘埗銆佹垨16榪涘埗
parseFloat(stringVar);
Number(stringVar);

for example:
parseInt("ff")    //will throw a error
parseInt("ff", 16) == parseInt("0xff")     // return 255
parseInt("77")    //return 77
parseInt("077") == parseInt("77", 8)    // return 63
娉細鍔?0"鎴?0x"鍓嶇紑浼氳嚜鍔ㄦ嫻嬪茍杞崲涓虹浉搴旂殑鏁板埗鎵琛ㄧず鐨勫?br /> If parseInt( ) or parseFloat( ) cannot convert the specified string to a number, it returns NaN

鏁板煎瀷杞崲涓哄瓧絎﹀瀷
numberVar + "";
numberVar.toString();   //鍙互鎸囧畾浜岃繘鍒躲佸叓榪涘埗銆佹垨16榪涘埗
String(numberVar);

other useful method
var n = 123456.789;
n.toFixed(0); // "123457"
n.toFixed(2); // "123456.79"
n.toExponential(1); // "1.2e+5"
n.toExponential(3); // "1.235e+5"
n.toPrecision(4); // "1.235e+5"
n.toPrecision(7); // "123456.8"

鍏跺疄榪樻湁涓縐嶆柟娉曞氨鏄嬌鐢╪ew鎿嶄綔絎︼紝濡?br /> new String(numberVar);
new Numer(stringVar);
浣嗘槸榪欑鏂規硶榪斿洖鐨勭粨鏋滄槸object綾誨瀷錛岃屼笉鏄師濮嬫暟鎹被鍨嬶紝澶у鍙互閰屾儏浣跨敤銆?br />
鍙﹀錛屽湪鐩哥瓑鍒ゆ柇鏃朵嬌鐢? == '浼氳嚜鍔ㄨ漿鍨嬶紙鍏蜂綋杞崲鎯呭喌璇峰弬鑰冨叾浠栬祫鏂欙級錛屽鏋滄兂綺劇‘鍒ゆ柇璇蜂嬌鐢? === '銆?br /> 濡?nbsp;  1 == '1'    //return true
       1 === '1' //return false
       1 == new Number(1)   //return true
       1 === new Number(1)   //return false

鏁板艱繛鎺ョ瓑鐩稿叧鎿嶄綔
"21" + "2" == "21" + 2  //return 212
2 + "21"   //return 221
"21" * "2" == "21" * 2 == 2 * "21"  //return 42
"21" / "3" == "21" / 3 == 21 / "3"  //return 7
"21" - "2" == "21" - 2  == 21 - "2" == 21 - "    2    "  //return 19

姝e鍜孞ava涓竴鏍鳳紝new Number(3) == new Number(3)榪斿洖false錛屽悓鐞嗘帹騫垮埌鍏朵粬綾誨瀷錛宯ew鎿嶄綔絎︽繪槸寤虹珛涓涓柊瀵硅薄錛?br /> 鑰?=鍙槸姣旇緝鍏跺紩鐢紝騫朵笉姣旇緝瀵硅薄鏈韓錛屾墍浠ヤ袱涓猲ew鐨勫璞$殑寮曠敤鎬繪槸涓嶅悓鐨勩傛墍浠ュ湪閫氬父鐨勯昏緫鍒ゆ柇涓?濡俰f鎴杦hile絳?錛?br /> 鏈濂介伩鍏嶄嬌鐢≒rimitive Datatype Wrapper錛岃岀洿鎺ヤ嬌鐢≒rimitive Datatype銆?br />
From Wrapper to Primitive, for example:
new Number(3).valueOf()
new String("str").valueOf()
new Date().valueOf()        //convert a Date to millisecond representation
[any other object].valueOf()    //The primitive value associated with the object, if any. If there is no value associated with object, returns the object itself.

Finally, note that any number, string, or boolean value can be converted to its corresponding wrapper object with the Object( ) function:

var number_wrapper = Object(3);



Automatic datatype conversions

Value

Context in which value is used


String

Number

Boolean

Object

Undefined value

"undefined"

NaN

false

Error

null

"null"

0

false

Error

Nonempty string

As is

Numeric value of string or NaN

TRue

String object

Empty string

As is

0

false

String object

0

"0"

As is

false

Number object

NaN

"NaN"

As is

false

Number object

Infinity

"Infinity"

As is

true

Number object

Negative infinity

"-Infinity"

As is

TRue

Number object

Any other number

String value of number

As is

true

Number object

true

"true"

1

As is

Boolean object

false

"false"

0

As is

Boolean object

Object

toString( )

valueOf( ), toString( ), or NaN

true

As is


鍒╃敤涓婇潰鐨勮〃錛屾垜浠彲浠ョ煡閬搃f ("") 銆乮f (0)銆乮f (undefined)銆乮f (null)銆乮f (NaN)錛岃繖浜沬f璇彞鐨勬潯浠墮兘涓篺alse.





teddy 2008-11-14 09:32 鍙戣〃璇勮
]]>
闈㈠悜瀵硅薄鐨凧avaScript錛堜簩錛孴SS涓婄殑涓綃囨枃绔狅紝鍏堝熼壌涓涓嬶級http://m.tkk7.com/smcdl/archive/2008/09/17/229519.htmlteddyteddyWed, 17 Sep 2008 12:15:00 GMThttp://m.tkk7.com/smcdl/archive/2008/09/17/229519.htmlhttp://m.tkk7.com/smcdl/comments/229519.htmlhttp://m.tkk7.com/smcdl/archive/2008/09/17/229519.html#Feedback0http://m.tkk7.com/smcdl/comments/commentRss/229519.htmlhttp://m.tkk7.com/smcdl/services/trackbacks/229519.html Object Oriented JavaScript Demonstrated



teddy 2008-09-17 20:15 鍙戣〃璇勮
]]>
闈㈠悜瀵硅薄鐨凧avaScript 錛堜竴銆佸璞″熀紜錛屼嬌鐢ㄥ嚱鏁版潵妯℃嫙綾伙級http://m.tkk7.com/smcdl/archive/2008/09/03/226748.htmlteddyteddyWed, 03 Sep 2008 11:09:00 GMThttp://m.tkk7.com/smcdl/archive/2008/09/03/226748.htmlhttp://m.tkk7.com/smcdl/comments/226748.htmlhttp://m.tkk7.com/smcdl/archive/2008/09/03/226748.html#Feedback1http://m.tkk7.com/smcdl/comments/commentRss/226748.htmlhttp://m.tkk7.com/smcdl/services/trackbacks/226748.html
  1function Person(name, age) {
  2
  3    //縐佹湁鍙橀噺(private variables)
  4    var myName = name;
  5    var myAge = age;
  6
  7    //鍏叡灞炴?public properties)
  8    this.name = myName;
  9    this.age = myAge;
 10    
 11    //縐佹湁鍑芥暟(private functions)
 12    function getMyName() {
 13    return myName;
 14    }
;
 15    
 16    function getName() {
 17    return name;
 18    }
;
 19    
 20    var getMyAge = function () {
 21    return myAge;
 22    }
;
 23    
 24    var getAge = function () {
 25    return age;
 26    }
;
 27    
 28    //鐗規潈鏂規硶(privileged methods)
 29    this.getName = function () {
 30    return this.name;
 31        //return myName;       鍙互璁塊棶縐佹湁鍙橀噺
 32    //return name;         鍙互璁塊棶鏋勯犲嚱鏁板弬鏁?鍏跺弬鏁版湰璐ㄤ篃鏄鏈夊彉閲?
 33    //return getMyName();  鍙互璁塊棶縐佹湁鍑芥暟
 34    //return getName();    鍙互璁塊棶縐佹湁鍑芥暟
 35    }
;
 36    
 37    this.getAge = function () {      
 38    return getAge();   
 39    }
;
 40    
 41    this.getRealAge = function () {
 42    return this.age;
 43    }
;
 44}

 45
 46//鍏叡鏂規硶(public methods)
 47Person.prototype.acceptName = function (param) {
 48    this.name = param;
 49    //name = param;       鍏叡鏂規硶涓嶈兘璁塊棶縐佹湁鍙橀噺
 50    //myName = param;     鍏叡鏂規硶涓嶈兘璁塊棶縐佹湁鍙橀噺
 51}
;
 52
 53//鍘熷瀷灞炴?prototype properties)
 54Person.prototype.legs = 2;
 55
 56//闈欐佸睘鎬?static properties)
 57//鏁翠釜綾誨彧鏈変竴涓潤鎬佸睘鎬э紝鍚勪釜瀵硅薄鍏變韓鍚屼竴涓潤鎬佸睘鎬у?/span>
 58Person.arms = 2;
 59
 60Person.getArms = function () {
 61    return Person.arms;
 62    //return this.arms;   鍙互浣跨敤this鏉ユ寚浠erson瀵硅薄鏈韓
 63}
;
 64
 65/*
 66Person鏄竴涓昏緫涓婄殑綾伙紝浠栫殑鏈川鏄竴涓狥unction錛屽湪JavaScript涓被鏄敱Function鏉ユā鎷熺殑錛屾墍浠erson榪樻槸涓涓狥unction鐨勫疄渚嬨傝宎rms鍜実etArms鏂規硶鏄竴涓狥unction瀵硅薄瀹炰緥涓婄殑灞炴у拰鏂規硶錛屾槸Person瀵硅薄鎵鐗規湁鐨勶紝鎵浠ユ湰渚嬪彲浠ヤ嬌鐢≒erson.arms鏉ュ紩鐢紝鍚屾椂鍦╣etArms鏂規硶涓紝鍙互浣跨敤this.arms鏉ュ紩鐢紝鍥犱負getArms鏄疨erson瀵硅薄涓婄殑鏂規硶錛屽湪璇ユ柟娉曞唴閮╰his鎸囦唬Person瀵硅薄鑷韓銆?br />  67*/

 68alert(Person.getArms());
 69
 70var pa = new Person("Teddy"25);
 71
 72//alert(pa.myName);  涓嶈兘璁塊棶縐佹湁鍙橀噺
 73
 74alert(pa.name);
 75
 76alert(pa.getAge());
 77
 78pa.acceptName("Born");
 79
 80alert(pa.getName());
 81
 82var pb = new Person("John"18);
 83
 84//榪愯鏃跺姩鎬佸姞鍏ユ柟娉?/span>
 85Person.prototype.acceptAge = function (param) {
 86    this.age = param;
 87}
;
 88
 89//pb瀵硅薄涔熷彲浠ヨ皟鐢ㄥ姩鎬佹坊鍔犵殑鏂規硶
 90pb.acceptAge(30);
 91
 92alert(pb.getAge());
 93
 94alert(pb.getRealAge());
 95
 96//榪愯鏃惰鐩栧凡瀹氫箟鏂規硶
 97Person.prototype.acceptName = function (param) {
 98    return param;
 99}
;
100
101//鎵鏈夊凡鍒涘緩瀵硅薄閮借嚜鍔ㄧ戶鎵胯瑕嗙洊鐨勬柟娉?/span>
102alert(pa.acceptName("Black"));
103
104alert(pa.getName());
105
106alert(pa.legs);
107
108//榪愯鏃舵敼鍙樺師鍨嬪睘鎬у?/span>
109Person.prototype.legs = 4;
110
111//鎵鏈夊凡鍒涘緩瀵硅薄閮借嚜鍔ㄧ戶鎵胯鏀瑰彉鐨勫師鍨嬪睘鎬у?/span>
112alert(pb.legs);
113
114//榪愯鏃跺皢鍘熷瀷灞炴ф敼涓哄叕鍏辨柟娉?/span>
115Person.prototype.legs = function () {
116    return 4;
117}
;
118
119//鎵鏈夊凡鍒涘緩瀵硅薄閮借嚜鍔ㄧ戶鎵垮師鍨嬪睘鎬у埌鍏叡鏂規硶鐨勬敼鍙?/span>
120alert(pa.legs());


teddy 2008-09-03 19:09 鍙戣〃璇勮
]]>
鍏煎IE鍜孎F鐨凧avascript鍔ㄦ佹坊鍔燬elect鎺т歡鐨凮ption閫夐」http://m.tkk7.com/smcdl/archive/2007/12/30/171771.htmlteddyteddySun, 30 Dec 2007 14:49:00 GMThttp://m.tkk7.com/smcdl/archive/2007/12/30/171771.htmlhttp://m.tkk7.com/smcdl/comments/171771.htmlhttp://m.tkk7.com/smcdl/archive/2007/12/30/171771.html#Feedback0http://m.tkk7.com/smcdl/comments/commentRss/171771.htmlhttp://m.tkk7.com/smcdl/services/trackbacks/171771.html selectObj.add(new Option("Label", "Value"));
浣嗘槸add鏂規硶濂藉儚鍙湪IE涓嬪ソ鐢ㄣ傜幇鍦ㄦ彁渚涗竴涓氱敤鐨勬柟娉曪細
selectObj.options[selectObj.length] = new Option("Label", "Value");
鍙﹀濡傛灉鎯寵繕鎯充嬌鐢╝dd鏂規硶錛屽彲浠ュ啓鎴愬涓嬫牸寮忥細
selectObj.add(new Option("Label", "Value"), null);
璇鋒敞鎰忥紝鍦↖E6鍙奍E7涓嬭浣跨敤涓嶅甫null鍙傛暟鐨刟dd鏂規硶錛屽湪FF涓嬭浣跨敤甯ull鍙傛暟鐨勬柟娉曪紝IE8涓嬪甫涓嶅甫閮藉彲浠ャ?br /> 寰堝鎬負浠涔堜竴瀹氳鍔爊ull錛屾垜鐚滄祴add鏂規硶閲屼竴瀹氫嬌鐢ㄤ簡'=== null'鏉ュ垽鏂浜岀殑鍙傛暟鎴栬呮病鏈夊鍙傛暟鏁扮粍鐨勯暱搴﹀仛楠岃瘉銆?br />

teddy 2007-12-30 22:49 鍙戣〃璇勮
]]>
鍏充簬IE涓嶧F瀵笻tmlElement灞炴ф搷浣滅殑涓嶅悓http://m.tkk7.com/smcdl/archive/2007/09/12/144618.htmlteddyteddyWed, 12 Sep 2007 13:17:00 GMThttp://m.tkk7.com/smcdl/archive/2007/09/12/144618.htmlhttp://m.tkk7.com/smcdl/comments/144618.htmlhttp://m.tkk7.com/smcdl/archive/2007/09/12/144618.html#Feedback4http://m.tkk7.com/smcdl/comments/commentRss/144618.htmlhttp://m.tkk7.com/smcdl/services/trackbacks/144618.html 浣嗘槸鏈変簺涓嶅彲浠ワ紝鍦‵F涓嬪繀欏葷敤element.getAttribute(attributeName)鏉ヨ鍙栥?br /> 騫朵笖錛孖E涓嬭繖涓夌鏂瑰紡鐨勮涓烘槸涓鑷寸殑錛岃孎F涓嬪墠涓ょ鍜屽悗涓縐嶆槸涓嶄竴鑷寸殑銆?br /> 鍚岀悊璁劇疆灞炴х殑鏂規硶涔熸槸涓嶄竴鑷寸殑銆?br /> 鍏跺唴閮ㄧ殑瀹炵幇鍘熺悊榪樹笉寰楄岀煡錛屽笇鏈涙湁鐭ラ亾鐨勬湅鍙嬫寚鐐逛竴浜屻?

teddy 2007-09-12 21:17 鍙戣〃璇勮
]]>
鍏充簬JavaScript鐨凱rototype鏇磋繘涓姝ョ殑璁ㄨhttp://m.tkk7.com/smcdl/archive/2007/05/26/120133.htmlteddyteddySat, 26 May 2007 00:49:00 GMThttp://m.tkk7.com/smcdl/archive/2007/05/26/120133.htmlhttp://m.tkk7.com/smcdl/comments/120133.htmlhttp://m.tkk7.com/smcdl/archive/2007/05/26/120133.html#Feedback1http://m.tkk7.com/smcdl/comments/commentRss/120133.htmlhttp://m.tkk7.com/smcdl/services/trackbacks/120133.html鏈枃灞炰簬涓瓑綰у埆鐨勬枃绔狅紝濡傛灉澶у瀵筄OP of JavaScript榪樹笉娓呮鐨勮瘽錛岃鍏堝幓浜嗚В涓涓嬶紝
鍐欐湰鏂囩殑鍘熷洜鏄範鎯簡Java銆丆#絳夎璦錛屽浜嶫avaScript鐨刾rototype錛堥氬父鎵璇寸殑鍘熷瀷錛夐潪甯?
涓嶉傚簲錛屽緢澶氭湅鍙嬪彲鑳介兘鏈夎繖鏍風殑浣撻獙錛岃繖綃囨枃绔犺兘瑙g瓟浣犱滑寰堝鐨勫悓綾婚棶棰樸?nbsp; 闃呰鍏ㄦ枃

teddy 2007-05-26 08:49 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 免费一区二区视频| 亚洲国产av美女网站| 成人性生免费视频| 特级做A爰片毛片免费看无码| 亚洲国产最大av| 久久亚洲AV成人出白浆无码国产| 免费一级肉体全黄毛片| 人妻视频一区二区三区免费| 日韩免费电影网址| 中文字幕版免费电影网站| 国产精品亚洲专一区二区三区| 亚洲精品综合久久中文字幕| 国产亚洲成AV人片在线观黄桃 | 国产亚洲精品一品区99热| 国产jizzjizz免费看jizz| 久久不见久久见中文字幕免费| 日韩插啊免费视频在线观看| 精品久久久久久无码免费| 高潮内射免费看片| 国产一区二区三区亚洲综合| 亚洲av永久无码| 亚洲αⅴ无码乱码在线观看性色| 国产精品亚洲专区在线观看| 亚洲乱码卡一卡二卡三| 亚洲成人福利网站| 亚洲无线一二三四区| 久久久久亚洲AV无码麻豆| 亚洲AV永久青草无码精品| 亚洲一区精品无码| 亚洲色中文字幕无码AV| 亚洲乱色熟女一区二区三区丝袜 | 黄床大片30分钟免费看| 午夜在线亚洲男人午在线| 爱情岛论坛亚洲品质自拍视频网站| 亚洲色大成网站www永久网站| 亚洲av日韩av无码av| 亚洲综合一区二区三区四区五区| 亚洲xxxx视频| 国产成人人综合亚洲欧美丁香花| 久久精品国产亚洲AV天海翼| 免费看又黄又无码的网站|