JavaScript 创建用于对象的模板【每日一段代码78】

<html>
<body>
<script type="text/javascript">
function person(firstname,lastname,age,eyecolor)
{
this.firstname=firstname;
this.lastname=lastname;
this.age=age;
this.eyecolor=eyecolor;
}
myFather=new person("John","Adams",35,"black");
document.write(myFather.firstname+" 的年龄是 "+myFather.age+" 岁。");
</script>
</body>
</html>

posted on 2012-04-10 21:47  Cosimo  阅读(203)  评论(0编辑  收藏  举报

导航