Capturing Hotkeys : Key Listener : Ajax Layer JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Ajax Layer » Key Listener »

 

Capturing Hotkeys




http://dynapi.sourceforge.net/
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
<html>
<head>
<title>DynAPI Examples - Capturing Hotkeys</title>
<script language="JavaScript" src="./dynapisrc/dynapi.js"></script>
<script language="Javascript">
  dynapi.library.setPath('./dynapisrc/');
  dynapi.library.include('dynapi.library');
  dynapi.library.include('dynapi.api');
  dynapi.library.include('dynapi.api.ext.DynKeyEvent');
  dynapi.library.include('dynapi.functions.Color');
</script>
<script language="Javascript">
  dynapi.document.captureHotKey('ctrl+z',fn);
  dynapi.document.captureHotKey('alt+x',fn1);
  dynapi.document.showScrollBars(true)

  function fn(){
    alert("Hello you've pressed Ctrl+Z")
  };
  function fn1(){
    dynapi.document.setBgColor(dynapi.functions.getRandomColor());
  };
</script>
</head>
<body>
Press ctrl+z to display a message<br>
Press atl+x to change the document background color

<p>Note: NS4 does not support the "alt" key nor the combination of more than one keys (e.g. ctrl+z)</p>
</body>
</html>

           
       

Download : Download nav_dynapi.zip nav_dynapi.zip


-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Ajax Layer
» Key Listener