日期:2014-05-16  浏览次数:20365 次

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>