关于javascript中for……in语句的疑问
<html><head><title>无标题文档</title></head>
<body>
<script language="javascript">
<!--
function Student()
{
this.name="张华";
this.age="19";
this.height="172";
}
var attr=new Student;
var prop,stru=" ";
for(prop in attr)
{
stru+=prop+" ";
}
alert(stru);
//-->
</script>
</body>
</html>
该程序中prop虽然已经定义过但并为对其赋值,它在程序中到底是干什么的?
追问:兄弟,这该我好好教教你了。可以放在<head></head>间也可以放在<body></body>间!!