<script type="text/javascript">
Object.extend = function (s, p) {
for (var i in p) {
s[i] = p[i];
}
return s;
};var Test = new Function();
Object.extend(Test.prototype, {
_alert : function() {
alert("VV");
}
});var ts = new Test();
ts._alert();
//Object 把Object换成Function就可以了。
</script>

解决方案 »

  1.   

    很明显是prototype.js中的方法
      

  2.   

    Prototype官方文档
    extend
    Object.extend(dest, src) -> alteredDest
    Copies all properties from the source to the destination object. Used by Prototype to simulate inheritance
    (rather statically) by copying to prototypes.
    Documentation should soon become available that describes how Prototype implements OOP, where you
    will find further details on how Prototype uses Object.extend and Class.create (something that may
    well change in version 2.0). It will be linked from here.
    Do not mistake this method with its quasi-namesake Element.extend, which implements Prototype’s
    (much more complex) DOM extension mechanism.