javascript最常用与实用的创建类的代码

时间:2010-08-12    点击:381   
复制代码 代码如下:

//以构造函数方式添加私有属性和方法
function Person(name, age, address) {
this.name = name;
this.age = age;
this.address = address;
}
//以原型方式添加公有属性、方法
Person.prototype = {
constructor: Person,
showName: function () {
alert(this.name + this.age + this.address);
}
}
//使用
var person = new Person("zhangsan", 22, "中国北京!");
person.showName();
Jquery从头学起第四讲 jquery入门教程
jQuery中的bind绑定事件与文本框改变事件的临时解决方法
基于jquery的兼容各种浏览器的iframe自适应高度的脚本
jquery实用代码片段集合
JavaScript中使用构造函数实现继承的代码
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved