码迷,mamicode.com
首页 > 其他好文 > 详细

关于this的小总结

时间:2017-01-09 21:34:38      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:app   nbsp   它的   this   调用   bsp   函数   timeout   改变   

关于对this目前有几点小理解

①this指向调用它的元素。就是谁调用它,它就指向谁。

②可以通过call()和apply()改变this的指向

③setInterval和setTimeout中的this指向window

④闭包中的this也指向Window

⑤自执行函数的this也指向window

⑥在事件中的this:在HTML事件中:this指向window

                         在DOM 0级事件中:this指向绑定事件的元素

                          在DOM 2级事件中:分情况 A.在IE中,this指向window     B.在非IE中,this指向绑定事件的元素

 

关于this的小总结

标签:app   nbsp   它的   this   调用   bsp   函数   timeout   改变   

原文地址:http://www.cnblogs.com/ranzhi/p/6266422.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!