08 2011 档案

摘要:Whenever you see the function keyword within another function, the inner function has access to variables in the outer function.function foo(x) { var tmp = 3; function bar(y) { alert(x + y + (++tmp)); } bar(10);}foo(2)This will always alert 16, becausebarcan access thexwhich was defined as an argum. 阅读全文
posted @ 2011-08-24 10:16 yhql_916 阅读(510) 评论(0) 推荐(0)
摘要:自学jquery的时候,看到一英文词(Callback),顿时背部隐隐冒冷汗。迅速google之,发现原来中文翻译成回调。也就是回调函数了。不懂啊,于是在google回调函数,发现网上的中文解释实在是太“深奥”了,我承认自己才疏学浅了。看了几个回调的例子后,貌似有点理解了。下面是我对回调函数的理解,要是理解错了,请指正,不甚感激。 首先还是从jquery网站上的英文定义入手,身为国人,我真感到悲剧。一个回调的定义被国内的“高手”解释成什么样,就在那绕圈子,貌似只有把你绕进去了,他才算高手。浮云,一切都是浮云。A callback is a function that is passed as 阅读全文
posted @ 2011-08-08 22:46 yhql_916 阅读(23752) 评论(16) 推荐(13)