www.webdeveloper.com
Results 1 to 3 of 3

Thread: how to read .js file from html?

Threaded View

  1. #1
    Join Date
    Sep 2008
    Posts
    62

    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
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

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