1,whit
[html]
<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]
<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>