码迷,mamicode.com
首页 > 编程语言 > 详细

JavaScript面向对象

时间:2017-03-18 21:04:06      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:meta   oct   doctype   cal   name   var   lang   面向对象   htm   

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<script>
    (function () {
        var n = "me";
        function people(name){
            this.oo=name;
        }
        people.prototype.say= function () {
            alert("poe-hello"+this.oo+n)
        };

        window.people=people;
        return n;
    }());
    (function () {
        function student(name){
            this.oo=name;
        }
        student.prototype=new people();
        var sups=student.prototype.say;
        student.prototype.say= function () {
            sups.call(this);
            alert("stu-hello"+this.oo);

        }
        window.student=student;
    }());

    var s=new student("ii");
    s.say();
</script>
</body>
</html>

 

JavaScript面向对象

标签:meta   oct   doctype   cal   name   var   lang   面向对象   htm   

原文地址:http://www.cnblogs.com/bengbengbengbengbeng/p/6575646.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!