基本实现了类似java的super功能

Posted on 2007-05-18 03:10 sunbaby 阅读(171) 评论(0)  编辑  收藏 所属分类: 其它

<script>
function A(){
    this.func1=function(){
        alert("A");
    }
}

function B(){
    this.func1=function(){
        delete this.func1;
        this.func1();
        this.func1=arguments.callee;
        alert("B");
    }
}
B.prototype=new A;
var o=new B;
o.func1();
</script>

posts - 2, comments - 2, trackbacks - 0, articles - 25

Copyright © sunbaby

free web counter
free web counter 点击发送消息给我