this

通过作用域决定 this 与哪个对象匹配

 

它的使用方式:

  1. 通过参数传递的方式, 如 <input ... onclick="dowhat(this)">, 指向 input 本身
  2. 通过对象赋值的方式, 如 element.onclick=dowhat, 指向 element
  3. 通过函数调用的方式, 如 dowhat(), 指向 window
posted @ 2011-12-08 11:43  Yu  阅读(109)  评论(0编辑  收藏  举报