<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script src="prototype.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">var Person = Class.create(); // 类的声明
Person.prototype = {
initialize: function(name) { // 构造函数
this.name = name;
},
printName: function() { // 成员函数
alert(this.name);
}
}
var persone = new Person("Joe Smith");// 创建实例
persone.printName(); // 函数调用
alert("aaa");
</script>
</head><body>
</body>
</html>
//少了一个,号
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script src="prototype.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">var Person = Class.create(); // 类的声明
Person.prototype = {
initialize: function(name) { // 构造函数
this.name = name;
},
printName: function() { // 成员函数
alert(this.name);
}
}
var persone = new Person("Joe Smith");// 创建实例
persone.printName(); // 函数调用
alert("aaa");
</script>
</head><body>
</body>
</html>
//少了一个,号
printName: function() { // 成员函数 这里 },
printName: function() { // 成员函数
有问题再请教你们 ^_^