ie8支持function.bind()方法
?123456789101112131415161718192021 <script type=text/javascript> if (!function.prototype.bind) { function.prototype.bind = function (othis) { if (typeof this !== function) { throw new typeerror(function.prototype.bind - what is trying to be bound is not callable); } var aargs = array.prototype.slice.call(arguments, 1), ftobind = this, fnop = function () {}, fbound = function () { return ftobind.apply(this instanceof fnop && othis ? this : othis, aargs.concat(array.prototype.slice.call(arguments))); }; fnop.prototype = this.prototype; fbound.prototype = new fnop(); return fbound; }; } </script>
主要解决“百度地图”官网上的例子的bug,摘取如下代码:
?12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 <!doctype html> <html> <head> <meta http-equiv=content-type content="text/html; charset=gbk""c_nrgg">