× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



> > Could you share that piece of JavaScript or post a link on how to learn to
> > map keys from the broswer?
>
>It depends on what you plan to do with the fkeys, but in general, you need
>an onkeypress function that looks something like this:
>
>   fnkey = -1;
>   if ((key >= 112) && (key <= 123)) fnkey = key-111;
>   if (window.event.shiftKey && fnkey > 0  && fnkey < 13) fnkey += 12;
>
>   if (fnkey > -1)
>   {
>     // An FKEY was pressed, and the key (1-24) is in fnkey
>     (...)
>   }

Thanks Joe,

i managed to make it work somehow, but i noticed the following:

onKeyPress catches all but function keys. I had to use onKeyDown.

i had to include that before the first use of variable "key":

key = window.event.keyCode;

But.... how do you prevent MS IE from taking its own action when a user
presses e.g. F1, F4, F5, F10, F11 (whether shifted or unshifted)?


for those interested - this works in IE 6.0 on my PC (PC = Personal
Configuration :-)

<html><head><title>Test</title>

<script language="JavaScript" type="text/javascript">
<!--
function fkey() {
   key = window.event.keyCode;
   fnkey = -1;
   if ((key >= 112) && (key <= 123)) fnkey = key-111;
   if (window.event.shiftKey && fnkey > 0  && fnkey < 13) fnkey += 12;


   if (fnkey > -1)
   {
     // An FKEY was pressed, and the key (1-24) is in fnkey
     alert ('F' + fnkey);
   }
}
//-->
</script>
</head><body onKeyDown="fkey()">

press a key...


</body></html>


Thanks in advance!


best regards /  Mit freundlichen Grüssen

Anton Gombkötö
Avenum Technologie GmbH

http://www.avenum.com



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.