<!DOCTYPE HTML>
<html>
<head>
<title>please enter your title</title>
<meta charset="utf-8">
<meta name="Author" content="年轻人">
<style type='text/css'>
*{ margin:0; padding:0;}
</style>
</head>
<body>
<script type="text/javascript">
function Person( name , age ){
this.name = name;
this.age = age;
}
Person.prototype.marry = true;
Person.prototype.showName = function(){
alert( this.name );
return this;
}
Person.prototype.showAge = function(){
alert( this.age );
return this;
}
var p1 = new Person('excel' , '35');
var p2 = new Person('逗逼丫丫' , '20');
var p3 = new Person('拖鞋' , '28');
p3.showName().showAge();
</script>
</body>
</html>
js原型链实例
最新推荐文章于 2023-03-27 14:19:48 发布