www.webdeveloper.com
Results 1 to 4 of 4

Thread: [RESOLVED] Detecting KeyDown

  1. #1
    Join Date
    Jul 2009
    Posts
    48

    resolved [RESOLVED] Detecting KeyDown

    Hello all,

    Im making a hta file, i have made a script in it to detect key dwon but it never seems to work. Below is my code.

    HTML Code:
    function detect()
    {
    	if (event.keyCode == 27)
    	{
    		window.location = "1.htm";
    	}
    
    	else if (event.keyCode == 116)
    	{
    		return false;
    	}
    
    	else if (event.keyCode == 117)
    	{
    		window.location = "2.htm";
    	}
    
    	else if (event.keyCode == 119)
    	{
    		window.location = "3.htm";
    	}
    
    	else if (event.keyCode == 120)
    	{
    		window.location = "4.htm";
    	}
    }
    
    document.onkeydown = detect;

  2. #2
    Join Date
    Mar 2009
    Posts
    452
    works fine for me

  3. #3
    Join Date
    Jul 2009
    Posts
    48
    i jst realised that i forgot to link the script to the page :-(

  4. #4
    Join Date
    Mar 2009
    Posts
    452
    ha ha ha

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles