<script> Function.prototype.$bind=function(object) { var callback = function () { return arguments[0]; } with(object) { return eval('callback(' + this.toString() + ')'); } }
var obj={a:1,b:2}; var f=function (){ a=10; b=11; }.$bind(obj);
f(); alert(obj.a); </script>