<script>
$(document).ready(function() { function Fun(a, b) { this.name = a; this.addr = b; } Fun.prototype.options = {}; $.extend(Fun.prototype.options, { a : "a", b : "b", c : "c" }); $.extend(Fun.prototype, { show : function() { alert("show__________" + this.name + "----" + this.addr); } }); Fun.prototype.test = { "hello" : "kitty" }; $.extend(Fun.prototype.test, { "helloKitty" : function() { }, "onPiece" : function(obj) { alert(obj.name + "----------" + obj.addr); }, "donaldDuck" : function() { alert("helloWorld"); } }); var fun = new Fun("pikachu", "dracula"); alert(fun.options.a); fun.show(); fun.test.onPiece(this);});
</script>