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;