摘要: JavaScript is a lexically scoped language: the scope of a variable can be thought of asthe set of source code lines for which the variable is defined.... 阅读全文
posted @ 2015-03-19 18:19 bjsunhe 阅读(154) 评论(0) 推荐(0) 编辑
摘要: Speed has always been one of Chrome's primary missions, ever since it was included as one of the founding principles in 2008. But speed is about more ... 阅读全文
posted @ 2015-03-19 17:12 bjsunhe 阅读(185) 评论(0) 推荐(0) 编辑
摘要: .on( events [, selector ] [, data ], handler )Description:Attach an event handler function for one or more events to the selected elements.绑定一个事件处理函数到... 阅读全文
posted @ 2015-03-19 16:41 bjsunhe 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 1. 使用最新版本的jQuery2. 用对选择器(1)最快的选择器:id选择器和元素标签选择器3. 理解子元素和父元素的关系4. 不要过度使用jQuery5. 做好缓存6. 使用链式写法7. 事件的委托处理(Event Delegation)。javascript的事件模型,采用"冒泡"模式,也就是... 阅读全文
posted @ 2015-03-19 16:04 bjsunhe 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 选择某个网页元素,然后对其进行某种操作 $(document) //选择整个文档对象 $('#myId') //选择ID为myId的网页元素 $('div.myClass') // 选择class为myClass的div元素 $('input[name=first]') // 选择name属... 阅读全文
posted @ 2015-03-19 15:38 bjsunhe 阅读(216) 评论(0) 推荐(0) 编辑
摘要: deferred对象的多种方法 (1)$.Deferred()生成一个deferred对象。 (2)deferred.done()指定操作成功时的回调函数 (3)deferred.fail()指定操作失败时的回调函数 (4)deferred.promise()没有参数时,返回一个新的def... 阅读全文
posted @ 2015-03-19 14:34 bjsunhe 阅读(127) 评论(0) 推荐(0) 编辑
摘要: Javascript语言的执行环境是"单线程"(single thread)一次只能完成一件任务。如果有多个任务,就必须排队,前面一个任务完成,再执行后面一个任务Javascript语言将任务的执行模式分成两种:同步(Synchronous)和异步(Asynchronous)"异步模式"则完全不同,... 阅读全文
posted @ 2015-03-19 14:25 bjsunhe 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 教人写代码 阅读全文
posted @ 2015-03-19 12:37 bjsunhe 阅读(143) 评论(0) 推荐(0) 编辑