var newDiv = document.createElement("div");
function show(){
console.log(this); //谁调用该函数,this指向的是谁
}
newDiv .onclick=function(){
this指向的是
}
/*=====================================================*/
function show(){
console.log(this); //this指向了window
}
show();//隐含window.show()
/*=====================================================*/
JavaScript this指向
最新推荐文章于 2022-12-30 14:37:01 发布