Blogger Information
Blog 4
fans 0
comment 0
visits 1968
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
7月10号作业
joe的博客
Original
466 people have browsed it

实例

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title></title>
</head>
<script type="text/javascript" charset="utf-8">
// 构造函数创建对象
    var Obj = function(){
        this.name = 'lili';
        this.age = 18;
        this.func = function(){
            return document.write('my name is' + this.name + 'my age is' + this.age );
        };
    };
    var obj1 = new Obj();
    obj1.func();
    // prototype函数添加对象成员
    Obj.prototype.sex = 'boy';
    document.write('</br>')
    document.write(obj1.sex);
</script>
<body>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例


Correction status:qualified

Teacher's comments:作业下次写上标题
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post