Use Event Arguments With Other Arguments?
Here's what I want to do: function someEvent(e) { } onxxxx='someEvent()' and turn that into: function someEvent(e, arg1, arg2) { } onxxxx='someEvent(???)' So basically, I want
Solution 1:
You can pass the event object as an argument:
onxxxx="someEvent(event, arg1, arg2);"
event
must be literal event
here.
Within the eventhandler function you find them like so:
functionsomeEvent(e, a, b) {
// e === event object// a === arg1// b === arg2
}
Solution 2:
You could use anonymous functions:
var arg1 = "12345 - test", arg2 = 42;
onxxxxx = function(e) {
someEvent.call(this, e, arg1, arg2);
};
Post a Comment for "Use Event Arguments With Other Arguments?"