﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-麦奏-随笔分类-javascript</title><link>http://www.blogjava.net/dlovek/category/19988.html</link><description>－my zone</description><language>zh-cn</language><lastBuildDate>Fri, 13 Apr 2007 15:26:40 GMT</lastBuildDate><pubDate>Fri, 13 Apr 2007 15:26:40 GMT</pubDate><ttl>60</ttl><item><title>JS简单AOP实现(转）</title><link>http://www.blogjava.net/dlovek/archive/2007/04/11/109918.html</link><dc:creator>麦奏</dc:creator><author>麦奏</author><pubDate>Wed, 11 Apr 2007 07:32:00 GMT</pubDate><guid>http://www.blogjava.net/dlovek/archive/2007/04/11/109918.html</guid><wfw:comment>http://www.blogjava.net/dlovek/comments/109918.html</wfw:comment><comments>http://www.blogjava.net/dlovek/archive/2007/04/11/109918.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/dlovek/comments/commentRss/109918.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/dlovek/services/trackbacks/109918.html</trackback:ping><description><![CDATA[<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;">&nbsp;1</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;">.&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">script</span><span style="color: #000000;">&gt;</span><span style="color: #000000;">&nbsp;&nbsp;<br></span><span style="color: #008080;">&nbsp;2</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">2</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">&nbsp;3</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">3</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">function</span><span style="color: #000000;">&nbsp;Test(){&nbsp;&nbsp;<br></span><span style="color: #008080;">&nbsp;4</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">4</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">this</span><span style="color: #000000;">.say1&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #0000ff;">function</span><span style="color: #000000;">(s){&nbsp;&nbsp;<br></span><span style="color: #008080;">&nbsp;5</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">5</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(s);&nbsp;&nbsp;<br></span><span style="color: #008080;">&nbsp;6</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">6</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;<br></span><span style="color: #008080;">&nbsp;7</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">7</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">this</span><span style="color: #000000;">.say2&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #0000ff;">function</span><span style="color: #000000;">(s){&nbsp;&nbsp;<br></span><span style="color: #008080;">&nbsp;8</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">8</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(s);&nbsp;&nbsp;<br></span><span style="color: #008080;">&nbsp;9</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">9</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;<br></span><span style="color: #008080;">10</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">10</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;<br></span><span style="color: #008080;">11</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">11</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">12</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">12</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">function</span><span style="color: #000000;">&nbsp;actsAsAspect(object)&nbsp;{&nbsp;&nbsp;<br></span><span style="color: #008080;">13</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">13</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;object.yield&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">null</span><span style="color: #000000;">;&nbsp;&nbsp;<br></span><span style="color: #008080;">14</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">14</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;object.rv&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;{&nbsp;};&nbsp;&nbsp;<br></span><span style="color: #008080;">15</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">15</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;object.before&nbsp;&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">function</span><span style="color: #000000;">(method,&nbsp;f)&nbsp;{&nbsp;&nbsp;<br></span><span style="color: #008080;">16</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">16</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">var</span><span style="color: #000000;">&nbsp;original&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;eval(</span><span style="color: #000000;">"</span><span style="color: #000000;">this.</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">+</span><span style="color: #000000;">&nbsp;method);&nbsp;&nbsp;<br></span><span style="color: #008080;">17</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">17</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">this</span><span style="color: #000000;">[method]&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">function</span><span style="color: #000000;">()&nbsp;{&nbsp;&nbsp;<br></span><span style="color: #008080;">18</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">18</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f.apply(</span><span style="color: #0000ff;">this</span><span style="color: #000000;">,&nbsp;arguments);&nbsp;&nbsp;<br></span><span style="color: #008080;">19</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">19</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">return</span><span style="color: #000000;">&nbsp;original.apply(</span><span style="color: #0000ff;">this</span><span style="color: #000000;">,&nbsp;arguments);&nbsp;&nbsp;<br></span><span style="color: #008080;">20</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">20</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;};&nbsp;&nbsp;<br></span><span style="color: #008080;">21</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">21</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;};&nbsp;&nbsp;<br></span><span style="color: #008080;">22</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">22</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;object.after&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">function</span><span style="color: #000000;">(method,&nbsp;f)&nbsp;{&nbsp;&nbsp;<br></span><span style="color: #008080;">23</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">23</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">var</span><span style="color: #000000;">&nbsp;original&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;eval(</span><span style="color: #000000;">"</span><span style="color: #000000;">this.</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">+</span><span style="color: #000000;">&nbsp;method);&nbsp;&nbsp;<br></span><span style="color: #008080;">24</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">24</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">this</span><span style="color: #000000;">[method]&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">function</span><span style="color: #000000;">()&nbsp;{&nbsp;&nbsp;<br></span><span style="color: #008080;">25</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">25</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">this</span><span style="color: #000000;">.rv[method]&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;original.apply(</span><span style="color: #0000ff;">this</span><span style="color: #000000;">,&nbsp;arguments);&nbsp;&nbsp;<br></span><span style="color: #008080;">26</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">26</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">return</span><span style="color: #000000;">&nbsp;f.apply(</span><span style="color: #0000ff;">this</span><span style="color: #000000;">,&nbsp;arguments);&nbsp;&nbsp;<br></span><span style="color: #008080;">27</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">27</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;<br></span><span style="color: #008080;">28</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">28</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;};&nbsp;&nbsp;<br></span><span style="color: #008080;">29</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">29</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;object.around&nbsp;&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">function</span><span style="color: #000000;">(method,&nbsp;f)&nbsp;{&nbsp;&nbsp;<br></span><span style="color: #008080;">30</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">30</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">var</span><span style="color: #000000;">&nbsp;original&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;eval(</span><span style="color: #000000;">"</span><span style="color: #000000;">this.</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">+</span><span style="color: #000000;">&nbsp;method);&nbsp;&nbsp;<br></span><span style="color: #008080;">31</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">31</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">this</span><span style="color: #000000;">[method]&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">function</span><span style="color: #000000;">()&nbsp;{&nbsp;&nbsp;<br></span><span style="color: #008080;">32</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">32</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">this</span><span style="color: #000000;">.yield&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;original;&nbsp;&nbsp;<br></span><span style="color: #008080;">33</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">33</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">return</span><span style="color: #000000;">&nbsp;f.apply(</span><span style="color: #0000ff;">this</span><span style="color: #000000;">,&nbsp;arguments);&nbsp;&nbsp;<br></span><span style="color: #008080;">34</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">34</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;<br></span><span style="color: #008080;">35</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">35</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;};&nbsp;&nbsp;<br></span><span style="color: #008080;">36</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">36</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;<br></span><span style="color: #008080;">37</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">37</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">38</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">38</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">function</span><span style="color: #000000;">&nbsp;beforeHander(s){&nbsp;&nbsp;<br></span><span style="color: #008080;">39</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">39</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(</span><span style="color: #000000;">"</span><span style="color: #000000;">aspect&nbsp;said:</span><span style="color: #000000;">"</span><span style="color: #000000;">);&nbsp;&nbsp;<br></span><span style="color: #008080;">40</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">40</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;<br></span><span style="color: #008080;">41</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">41</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">function</span><span style="color: #000000;">&nbsp;afterHander(s){&nbsp;&nbsp;<br></span><span style="color: #008080;">42</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">42</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(</span><span style="color: #000000;">"</span><span style="color: #000000;">said&nbsp;by&nbsp;aspect</span><span style="color: #000000;">"</span><span style="color: #000000;">);&nbsp;&nbsp;<br></span><span style="color: #008080;">43</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">43</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;<br></span><span style="color: #008080;">44</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">44</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">45</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">45</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">var</span><span style="color: #000000;">&nbsp;t&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;Test();&nbsp;&nbsp;<br></span><span style="color: #008080;">46</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">46</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;actsAsAspect(t);&nbsp;&nbsp;<br></span><span style="color: #008080;">47</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">47</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;t.before(</span><span style="color: #000000;">"</span><span style="color: #000000;">say1</span><span style="color: #000000;">"</span><span style="color: #000000;">,beforeHander);&nbsp;&nbsp;<br></span><span style="color: #008080;">48</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">48</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;t.after(</span><span style="color: #000000;">"</span><span style="color: #000000;">say2</span><span style="color: #000000;">"</span><span style="color: #000000;">,afterHander);&nbsp;&nbsp;<br></span><span style="color: #008080;">49</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">49</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">50</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">50</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;test&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">function</span><span style="color: #000000;">(){&nbsp;&nbsp;<br></span><span style="color: #008080;">51</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">51</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;t.say1(</span><span style="color: #000000;">"</span><span style="color: #000000;">hello1</span><span style="color: #000000;">"</span><span style="color: #000000;">);&nbsp;&nbsp;<br></span><span style="color: #008080;">52</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">52</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;t.say2(</span><span style="color: #000000;">"</span><span style="color: #000000;">hello2</span><span style="color: #000000;">"</span><span style="color: #000000;">);&nbsp;&nbsp;<br></span><span style="color: #008080;">53</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">53</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;<br></span><span style="color: #008080;">54</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">54</span><span style="color: #000000;">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;test();&nbsp;&nbsp;<br></span><span style="color: #008080;">55</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">55</span><span style="color: #000000;">.&nbsp;</span><span style="color: #000000;">&lt;/</span><span style="color: #000000;">script</span><span style="color: #000000;">&gt;</span><span style="color: #000000;">&nbsp;&nbsp;</span></div>
<br><img src ="http://www.blogjava.net/dlovek/aggbug/109918.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/dlovek/" target="_blank">麦奏</a> 2007-04-11 15:32 <a href="http://www.blogjava.net/dlovek/archive/2007/04/11/109918.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>js一些小方法</title><link>http://www.blogjava.net/dlovek/archive/2007/02/28/101246.html</link><dc:creator>麦奏</dc:creator><author>麦奏</author><pubDate>Wed, 28 Feb 2007 15:58:00 GMT</pubDate><guid>http://www.blogjava.net/dlovek/archive/2007/02/28/101246.html</guid><wfw:comment>http://www.blogjava.net/dlovek/comments/101246.html</wfw:comment><comments>http://www.blogjava.net/dlovek/archive/2007/02/28/101246.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/dlovek/comments/commentRss/101246.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/dlovek/services/trackbacks/101246.html</trackback:ping><description><![CDATA[1. 
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080">1</span><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000"> test()</span><span id="Codehighlighter1_16_86_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">3</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    alert(arguments.length);</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 src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">     alert(test.length);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">行参的数目</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">5</span><span style="COLOR: #008000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" /></span><span style="COLOR: #000000">}</span></span></div>2.callee返回当前方法的引用<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080">1</span><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000"> test()</span><span id="Codehighlighter1_16_155_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">3</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    alert(arguments.callee.length);</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 src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">     </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">arguments.callee返回当前方法的引用，所以</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">5</span><span style="COLOR: #008000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">     </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">arguments.callee == test</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">6</span><span style="COLOR: #008000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">所以实际上仍然伪test.length</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">7</span><span style="COLOR: #008000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" /></span><span style="COLOR: #000000">}</span></span></div>3.call(),apply()<br />call()传递单个参数，apply()参数传递为数组参数<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080">1</span><img id="Codehighlighter1_12_117_Open_Image" onclick="this.style.display='none'; Codehighlighter1_12_117_Open_Text.style.display='none'; Codehighlighter1_12_117_Closed_Image.style.display='inline'; Codehighlighter1_12_117_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_12_117_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_12_117_Closed_Text.style.display='none'; Codehighlighter1_12_117_Open_Image.style.display='inline'; Codehighlighter1_12_117_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /><span style="COLOR: #0000ff">var</span><span style="COLOR: #000000"> Class </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span id="Codehighlighter1_12_117_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"></span><span id="Codehighlighter1_12_117_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">2</span><span style="COLOR: #000000"><img id="Codehighlighter1_35_115_Open_Image" onclick="this.style.display='none'; Codehighlighter1_35_115_Open_Text.style.display='none'; Codehighlighter1_35_115_Closed_Image.style.display='inline'; Codehighlighter1_35_115_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_35_115_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_35_115_Closed_Text.style.display='none'; Codehighlighter1_35_115_Open_Image.style.display='inline'; Codehighlighter1_35_115_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />  create: </span><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000">() </span><span id="Codehighlighter1_35_115_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"></span><span id="Codehighlighter1_35_115_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">3</span><span style="COLOR: #000000"><img id="Codehighlighter1_59_111_Open_Image" onclick="this.style.display='none'; Codehighlighter1_59_111_Open_Text.style.display='none'; Codehighlighter1_59_111_Closed_Image.style.display='inline'; Codehighlighter1_59_111_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_59_111_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_59_111_Closed_Text.style.display='none'; Codehighlighter1_59_111_Open_Image.style.display='inline'; Codehighlighter1_59_111_Open_Text.style.display='inline';" src="http://www.blogjava.net/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 id="Codehighlighter1_59_111_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"></span><span id="Codehighlighter1_59_111_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">4</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />      </span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.initialize.apply(</span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">, arguments);<br /></span><span style="COLOR: #008080">5</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">6</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />  }</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">7</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">8</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span></div><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">var</span><span style="COLOR: #000000"> vehicle</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">Class.create();</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">vehicle为一个方法，</span><span style="COLOR: #008000">所以可以有prototype属性。返回的是一个构造函数。</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080"> 3</span><span style="COLOR: #008000"><img id="Codehighlighter1_81_243_Open_Image" onclick="this.style.display='none'; Codehighlighter1_81_243_Open_Text.style.display='none'; Codehighlighter1_81_243_Closed_Image.style.display='inline'; Codehighlighter1_81_243_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_81_243_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_81_243_Closed_Text.style.display='none'; Codehighlighter1_81_243_Open_Image.style.display='inline'; Codehighlighter1_81_243_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="COLOR: #000000">vehicle.prototype</span><span style="COLOR: #000000">=</span><span id="Codehighlighter1_81_243_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"></span><span id="Codehighlighter1_81_243_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080"> 4</span><span style="COLOR: #000000"><img id="Codehighlighter1_112_164_Open_Image" onclick="this.style.display='none'; Codehighlighter1_112_164_Open_Text.style.display='none'; Codehighlighter1_112_164_Closed_Image.style.display='inline'; Codehighlighter1_112_164_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_112_164_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_112_164_Closed_Text.style.display='none'; Codehighlighter1_112_164_Open_Image.style.display='inline'; Codehighlighter1_112_164_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    initialize:</span><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000">(type)</span><span id="Codehighlighter1_112_164_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"></span><span id="Codehighlighter1_112_164_Open_Text"><span style="COLOR: #000000">{</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">这个方法在创建vihicle的对象的时候被调用</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080"> 5</span><span style="COLOR: #008000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.type</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">type;<br /></span><span style="COLOR: #008080"> 6</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 7</span><span style="COLOR: #000000"><img id="Codehighlighter1_189_241_Open_Image" onclick="this.style.display='none'; Codehighlighter1_189_241_Open_Text.style.display='none'; Codehighlighter1_189_241_Closed_Image.style.display='inline'; Codehighlighter1_189_241_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_189_241_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_189_241_Closed_Text.style.display='none'; Codehighlighter1_189_241_Open_Image.style.display='inline'; Codehighlighter1_189_241_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    showSelf:</span><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000">()</span><span id="Codehighlighter1_189_241_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"></span><span id="Codehighlighter1_189_241_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080"> 8</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        alert(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">this vehicle is </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.type);<br /></span><span style="COLOR: #008080"> 9</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /></span><span style="COLOR: #008080">12</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">var</span><span style="COLOR: #000000"> moto</span><span style="COLOR: #000000">=</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> vehicle(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Moto</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">13</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />moto.showSelf();<br /></span><span style="COLOR: #008080">14</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span></div><img src ="http://www.blogjava.net/dlovek/aggbug/101246.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/dlovek/" target="_blank">麦奏</a> 2007-02-28 23:58 <a href="http://www.blogjava.net/dlovek/archive/2007/02/28/101246.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>html中几个值得注意的问题</title><link>http://www.blogjava.net/dlovek/archive/2007/02/16/100039.html</link><dc:creator>麦奏</dc:creator><author>麦奏</author><pubDate>Fri, 16 Feb 2007 03:30:00 GMT</pubDate><guid>http://www.blogjava.net/dlovek/archive/2007/02/16/100039.html</guid><wfw:comment>http://www.blogjava.net/dlovek/comments/100039.html</wfw:comment><comments>http://www.blogjava.net/dlovek/archive/2007/02/16/100039.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/dlovek/comments/commentRss/100039.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/dlovek/services/trackbacks/100039.html</trackback:ping><description><![CDATA[1.form元素是默认有padding的。<br />2.tbody在ie下没有innerHTML属性。<br /><img src ="http://www.blogjava.net/dlovek/aggbug/100039.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/dlovek/" target="_blank">麦奏</a> 2007-02-16 11:30 <a href="http://www.blogjava.net/dlovek/archive/2007/02/16/100039.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一点函数式编程心得</title><link>http://www.blogjava.net/dlovek/archive/2007/02/14/99850.html</link><dc:creator>麦奏</dc:creator><author>麦奏</author><pubDate>Wed, 14 Feb 2007 10:00:00 GMT</pubDate><guid>http://www.blogjava.net/dlovek/archive/2007/02/14/99850.html</guid><wfw:comment>http://www.blogjava.net/dlovek/comments/99850.html</wfw:comment><comments>http://www.blogjava.net/dlovek/archive/2007/02/14/99850.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/dlovek/comments/commentRss/99850.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/dlovek/services/trackbacks/99850.html</trackback:ping><description><![CDATA[
		<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(b)<br /></span><span style="color: rgb(0, 128, 128);">2</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);">    b();<br /></span><span style="color: rgb(0, 128, 128);">4</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);">a(</span><span style="color: rgb(0, 0, 255);">function</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);">1</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);});</span></div>我理解，好像调用a方法时候，内部的函数相当于一个匿名的变量，这个变量保存了当前内部函数的引用。<br /><img src ="http://www.blogjava.net/dlovek/aggbug/99850.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/dlovek/" target="_blank">麦奏</a> 2007-02-14 18:00 <a href="http://www.blogjava.net/dlovek/archive/2007/02/14/99850.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>