【文件属性】:
文件名称:关于function类中定义变量this的简单说明
文件大小:24KB
文件格式:PDF
更新时间:2020-11-26 01:19:39
c fu func
关于function类中定义变量this的简单说明
<!DOCTYPE html>
<html>
<head>
</head>
[removed]
function TObject(){
this.name1 = "aa";//这里不能写name,name是window的变量。否则无法得到验证结果
}
var t = new TObject();//执行中,this代表t
alert("window1="+this.name1);//没有值
alert("t="+t.name1);//有值
TObject();//执行中,this代表window
alert("window