KeyEvent

Aus Programmers Guide

(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
Roy (Diskussion | Beiträge)
(Die Seite wurde neu angelegt: „== JavaScript and KeyEvents == <source lang="javascript"> <script type="text/javascript"> document.onkeyup = KeyCheck; function KeyCheck(e){ var KeyID = (wi…“)

Aktuelle Version vom 16:28, 6. Jul. 2010

JavaScript and KeyEvents

<script type="text/javascript">
document.onkeyup = KeyCheck;
 
function KeyCheck(e){
 
   var KeyID = (window.event) ? event.keyCode : e.keyCode;
 
   switch(KeyID){
 
      case 16:
      //Shift;
      break; 
      case 17:
      //"Ctrl";
      break;
      case 18:
      //"Alt";
      break;
      case 19:
      //"Pause";
      break;
      case 37:
      //"Arrow Left";
	//Virtual click on a Link
	window.location=document.getElementById('prevdaylink').href;
 
      break;
      case 38:
      //"Arrow Up";
      break;
      case 39:
      //"Arrow Right";
	//Virtual click on a Link
	window.location=document.getElementById('nextdaylink').href;
 
      break;
      case 40:
      //"Arrow Down";
      break;
  }
}
 
</script>
Persönliche Werkzeuge