<script type="text/javascript">
function FBI(){
    this.name="fbi";
}
FBI.prototype.sayHello=function(){
    alert(this.name);
}
var fbi=new FBI();
fbi.sayHello();RegExp.prototype.showPattern=function(){
    alert(this.source);
}
var reg=/\d*/;
reg.showPattern();
</script>

解决方案 »

  1.   

    Object.prototype.a = function(){
    alert(this);
    }
    String.prototype.a = function(){
    alert(this);
    }
    RegExp.prototype.a = function(){
    alert(this);
    }
    var str = /\d*/;
    str.a();var str = function(){
    alert(1);
    }
    str.a();
      

  2.   


    <html>
    <BODY>
    <a onclick="Noooooo('day')">click me,here</a>
    </BODY>
    </HTML><script>
    var LZ={};
    LZ.IsBoy=function(){alert('Yes!');};
    LZ.IsBoy();LZ.GetColor=function(when){if(when=="day"){alert('黑色')}else{alert('红色')}};function Noooooo(p)
    {
    LZ.GetColor(p);
    }
    </script>