Ian said:
Parameters are irrelevant here, 'myFunction' is the function reference.
It doesn't magically know, it is passed when then event handler is called.
Modern browsers call event handling callbacks with an event object as
their parameter, IE calls them with window.event as the event object.
So non-IE browser while looking at that function definition - say
function myF(parA, parB, parC)
ALWAYS assumes that parA is event
and in the 'body' of that function I can use say
if (parA.ctrlKey)
return true;
?
Then it _is_ a magic
So, always parameter #1? Or it's allowed
to have only one parameter at that's it? And the assumption that
it's event ?
Or you are saying that NO parameters are needed in the function
_definition_ - just
function myF()
{
}
and event is a pre-set, special name that can be used
like this
if (event.ctrlKey)
return true;
?
Presently I have say (event is 2nd parameter)
<textarea .... onkeypress=vkb_changeKey (this, event)
with parameters being set and used like this:
function vkb_changeKey (txtControl, evt)
{
if (evt.ctrlKey)
return true;
}
**********************************
So you guys are saying that it's possible to do the same
by
txtObject.onkeypress=vkb_changeKey;
and use some other methods for getting hold of text Object
(with the lcuk of 'this' as a parameter)
and use some other methods of using event ?