[thelist] Javascript keyboard events

VOLKAN ÖZÇELİK volkan.ozcelik at gmail.com
Wed Dec 28 13:21:41 CST 2005


Why don't you just sniff the event's keyCode and act accordingly?

element.onkeypress = element_keypress;

function element_keypress(evt){
    var theCode=event.keyCode;

    switch(theCode){
          case 9: //tab
             //do your control
             break;
          ...
          default:
               //the default fallback
               break;
    }
}

Besides, I didn't quite understand your intention here.
You can always call a proxy inside your event-handler.

function element_keypress(evt){
     var param1="lorem";
     var param2="ipsum";
     var param3="dolor";
     var param4="sit";
     somebodyHasPressedMyLovelyKeyboard(param1, param2, param3, param4);
}

function somebodyHasPressedMyLovelyKeyboard(/*varargin*/){
//handle your action here
}

HTH
--
Volkan Ozcelik
+>Yep! I'm blogging! : http://www.volkanozcelik.com/volkanozcelik/blog/
+> My projects/studies/trials/errors : http://www.sarmal.com/



More information about the thelist mailing list