cssText 和 this

一、cssText

元素.style.width = '200px';   ==>   元素.style.cssText = 'width:200px;height:200px;'

 

二、this

1、含义:指的是调用当前方法(函数的那个对象)

2、调用

              function fn1(){ this }

 1) fn1()                            this  =>  window                   (直接调用)

 2)   oDiv.onclick = fn1;       this  =>  oDiv                       (事件调用)

 3)  oDiv.onclick = function (){                                          (匿名调用)

    this                           ( this  =>  oDiv )

    fn1();                      (  fn1()里的this  =>  window )

    }

posted @ 2015-12-03 16:17  EffieDuo  阅读(147)  评论(0编辑  收藏  举报