Link to home
Start Free TrialLog in
Avatar of edoyuk
edoyuk

asked on

disabling F1,F2,F3....

Is it possible to disable F1,F2... with javascript?

For example, in my web page I wanna use F3 but I dont wanna the search screen appearing on the left?
Thanks...
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
f example
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
      <title>Untitled</title>
</head>

<body>
<script>
keys = new Array();
keys["f112"] = 'f1';
keys["f113"] = 'f2';
keys["f114"] = 'f3';
keys["f115"] = 'f4';
keys["f116"] = 'f5';
keys["f117"] = 'f6';
keys["f118"] = 'f7';
keys["f119"] = 'f8';
keys["f120"] = 'f9';
keys["f121"] = 'f10';
keys["f122"] = 'f11';
keys["f123"] = 'f12';

saveCode=""
function myFunc(code) {
  alert('testing '+code)
}

document.onkeydown = function(){
 // Capture and remap F-key
  if(window.event && keys["f"+window.event.keyCode])  {
    saveCode=window.event.keyCode;
    window.event.keyCode = 505;
  }
  if(window.event && window.event.keyCode == 505) {
    // New action for keycode
    myFunc(saveCode)
    return false; // Must return false or the browser will execute old code
      }
}
</script>


</body>
</html>
Avatar of edoyuk
edoyuk

ASKER

doesn't work!

Search screen places on the left after alerting " F3 key was pressed"
Avatar of edoyuk

ASKER

Sorry, it works!
Thanks a lot.
Thanks this works great for HTML/JavaScript.  Do you know if there's anyway to apply this to an embedded Flash object?