Possible Duplicate:
How do I pass arguments to bound methods
How do I use bind() in this instance.
I need to bind a function …but the code below calls it. How do I use bind(). I read the MDN documentation but it did not make sense.
bind_enter_key and bind_file_upload are methods i wrote.
m5('signin_pass',bind_enter_key(event,interface_signin)); // this does not work
m5('upload_file',bind_file_upload);
// just a minimzer
function m5(a,b)
{
return document.getElementById(a).onkeypress=b;
}
Wow, you really made this confusing by using
bindin two different ways (one in your function name and one in the operation you want to perform on that function).Note that you seem to be binding to the current value of
window.eventby doing this, which is probably a horrible idea. Better might be