1 Attachment(s)
how to read .js file from html?
Hi guys,
I need your help, I have a problem with my external .js file where I cant be able to read the javascript to get things right and working, but it is not working when I press on the keyboard up and down arrow buttons.
here is the html code:
Code:
<html>
<body>
<style type="text/css">
body {background:url('/images/blue_background.jpg') no-repeat center center fixed;}
</style>
<body style="overflow: hidden">
<script>
<script type="text/javascript" src="test.js"></script>
<script type="text/javascript">
</script>
</body>
</html>
here is the test.js file
Code:
document.onkeydown = checkKey;
function checkKey(e) {
if(key == 38)
{
alert('up arrow are working');
}
if(key == 40)
{
alert('down arrow are working');
}
I have attached the zip file so you will know why it is not working.
Any advice would be much appreicated.
thanks in advance