如何重载Javascript内置函数?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html>
 <head>
  <title></title>
 </head>
<script>
   window.Date = window.Date;
   window.Date = function(){
       return "2013-11-22"
   }
   function myDate(){
      var d = new Date();
      document.write (d);
   }
</script>
 <body>
   <input type="button" name="Test" value="Test" onclick="myDate()"/>
 </body>
</html>

参考:http://www.adequatelygood.com/Replacing-setTimeout-Globally.html

你可能感兴趣的:(如何重载Javascript内置函数?)