<div class="codetitle"> <span><a style="CURSOR: pointer" data="74309" class="copybut" id="copybut74309" onclick="doCopy('code74309')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code74309"> <br> <br> <br><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <br><title>测试</title> <br> <br> <br><script type="text/javascript"><!-- <BR>function Man(name, age) { <BR>//定义实例属性 <BR>this.name = name; <BR>this.age = age; <BR>} <br><br>//定义静态属性。默认性别是男,不排除变性,^v^ <BR>Man.sex = '男'; <BR>//定义原型属性 <BR>Man.prototype.phone = '123456'; <BR>//除了name.sex和Man.prototype.phone其余全部是Undefined <BR>alert(Man.sex + "-----" + Man.prototype.phone + "--" + Man.name + "--" + Man.age + "--" + Man.phone); <BR>var man = new Man("Tom", 24); <BR>alert(Man.sex + "--" + man.name + "--" + man.age + "--" + man.phone); <BR>/** <BR>* 通过例子说明:原型属性在实例化之后作为类的实例属性。 <BR>* 但是实例属性在实例化之后却不能作为原型属性。 <BR>*/ <br><br>// --></script> <br> <br><br> </div>