文章标题

来源:互联网 发布:淮南市大数据 编辑:程序博客网 时间:2024/05/16 05:16

js原型链

<!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>
0 0
原创粉丝点击