欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

關(guān)于function類中定義變量this的簡單說明

 更新時(shí)間:2016年05月28日 15:03:23   投稿:jingxian  
下面小編就為大家?guī)硪黄P(guān)于function類中定義變量this的簡單說明。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧

關(guān)于function類中定義變量this的簡單說明

<!DOCTYPE html> 
<html>
<head> 
</head> 
<script>
	function TObject(){
		 this.name1 = "aa";//這里不能寫name,name是window的變量。否則無法得到驗(yàn)證結(jié)果
	}
	var t = new TObject();//執(zhí)行中,this代表t
	alert("window1="+this.name1);//沒有值
	alert("t="+t.name1);//有值
	TObject();//執(zhí)行中,this代表window
	alert("window2="+this.name1);
</script>
<body> 
</body> 
</html> 

以上這篇關(guān)于function類中定義變量this的簡單說明就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論