Results 1 to 3 of 3

Thread: how to read .js file from html?

Hybrid View

  1. #1
    Join Date
    Sep 2008

    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:

    <style type="text/css">
    body {background:url('/images/blue_background.jpg') no-repeat center center fixed;}
    <body style="overflow: hidden">
      <script type="text/javascript" src="test.js"></script>
      <script type="text/javascript">

    here is the test.js file

    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

  2. #2
    Join Date
    Feb 2013
    Im new as well but I beleive this

    <script type="text/javascript" src="test.js"></script>
    <script type="text/javascript">


    Is supposed to be between the <head> </head>

  3. #3
    Join Date
    Dec 2005
    Seems to have been asked and answered at: http://www.codingforums.com/showthre...17#post1321217

    Moving to a different forum will not change the answer.
    Last edited by JMRKER; 03-17-2013 at 11:30 PM.

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