//JavaScript での クラスとthis の確認

function　test_this(){
	this.var1="test_thisの変数";
	document.getElementById('span1').innerHTML=this.var1;
	//func_this(this);
	//this 確認用関数
	func_no_this = function() {
		//alert(this.var1); テスト表示用
		document.getElementById('span2').innerHTML=this.var1;
	}
	//クラスのメソッドで呼ぶときは 無名関数に this.をつける
	this.func_this = function() {
		//alert(this.var1); テスト表示用
		document.getElementById('span3').innerHTML=this.var1;
	}
}

function class_test(){
	//クラスのオブジェクトを作る
	var this1=new test_this();
	this1.var1 = "変数変更";
	func_no_this();//関数を呼ぶ
	this1.func_this();//クラスのメソッドを呼ぶ
}

