JS中this的理解

// this: 指的是调用 当前 方法(函数)的那个对象

 <script>

function fn1(){

this

}

情况1:fn1()                  //这里this=>window

情况2:oDiv.onclick=fn1;// this=>oDiv

情况3:oDiv.onclick=function(){

fn1()                         // fn1里面的this=>window

}

</script>

posted @ 2016-07-24 12:55  啄木鸟伍迪  阅读(128)  评论(0)    收藏  举报
//火箭 GenerateContentList();