Web page function keys

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Don W.

    #1

    Web page function keys

    I need to use some function keys as speed-keys (instead of clicking a button
    with the mouse.) Using this code doesn't display any codes for the function
    keys:

    <html><body>
    <SCRIPT LANGUAGE="JavaS cript">
    document.onkeyp ress = Check_key;

    function Check_key()
    {
    whichKey = String.fromChar Code(event.keyC ode).toLowerCas e();
    alert(whichKey) ;
    }

    </SCRIPT>
    </body></html>

    How can I capture the pressing of the function keys?

    Don W.



  • Erwin Moller

    #2
    Re: Web page function keys

    "Don W." <dNOSPAMwidders AThotmail.com> wrote:
    [color=blue]
    > I need to use some function keys as speed-keys (instead of clicking a
    > button
    > with the mouse.) Using this code doesn't display any codes for the
    > function keys:
    >
    > <html><body>
    > <SCRIPT LANGUAGE="JavaS cript">
    > document.onkeyp ress = Check_key;
    >
    > function Check_key()
    > {
    > whichKey = String.fromChar Code(event.keyC ode).toLowerCas e();
    > alert(whichKey) ;
    > }
    >
    > </SCRIPT>
    > </body></html>
    >
    > How can I capture the pressing of the function keys?
    >
    > Don W.[/color]

    Hi Don,

    You didn't pass Event to the function...
    And use Event.which
    The following code works fine under Mozilla 1.4

    <SCRIPT LANGUAGE="JavaS cript">
    document.onkeyp ress = Check_key;

    function Check_key(Event )
    {
    whichKey = String.fromChar Code(Event.whic h).toLowerCase( );
    alert(whichKey) ;
    }
    </SCRIPT>

    Good luck,

    Reagrds,
    Erwin Moller

    Comment

    Working...