红色的那段是什么意思了?不能写成st1.avg=avg();吗? 大哥们指教一下啊
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
{
function student(name,chinese,math,english)
{
this.name=name;
this.chinese=chinese;
this.math=math;
this.english=english;
}
function avg()
{
return((this.chinese+this.math+this.english)/3);
}
}
</script>
</head>
<body>
<script language="javascript">
{
var st1=new student("原",78,67,98);
st1.avg=avg;
var avgscore=st1.avg();
document.write("姓名:"+st1.name+"<br>");
document.write("语文:"+st1.chinese+"<br>");
document.write("数学:"+st1.math+"<br>");
document.write("英语:"+st1.english+"<br>");
document.write("平均:"+avgscore);
}
</script>
</body>
</html>