JSP(对象专用语句)

1,whit

<html>
<script language="javascript">
	
	var current_time = new Date();

	/*
	用with 不需要为每次的方法调用指定对象
	*/
	whit(current_time)
	{
		var strDate=getYear()+"-";
		strDate +=getMonth()+"-";
		strDate +=getDate();
		alert(DatStr);
	}
	
</script>
</html>

2,for ... in: 遍历

<html>
<script language="javascript">
	
	function Person()
	{
		this.name="zxx";
		this.age=12;
		this.height=176;
	}

	var p1 = new Person();
	var prop,str="";
	for(prop in p1) 
	{
		str +=prop + " ";
	}
	alert(str);
	
</script>
</html>


posted on 2012-09-13 11:20  Yours风之恋  阅读(158)  评论(0编辑  收藏  举报