欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

js里的prototype使用示例

 更新時(shí)間:2010年11月19日 21:19:34   作者:  
Object對象是common的原型,Object對象的屬性和方法復(fù)制到了common上
復(fù)制代碼 代碼如下:

<script type="text/javascript">
function people(name){
this.name=name;
this.introduce=function(){ //對象方法
alert("my name is"+this.name);
}
}

people.run=function(){ //類方法
alert("i can run");
}

people.prototype.jump=function(){ //原型方法
alert("i can jump")
}

var p1=new people("vincent");
p1.introduce();
people.run(); //c#中的static
p1.jump();
</script>

復(fù)制代碼 代碼如下:

function common(){
//.....
}
common.prototype=new Object();

Object對象是common的原型,Object對象的屬性和方法復(fù)制到了common上

相關(guān)文章

最新評論