Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Linking to 'external.js' file

Options
  • 29-07-2005 12:25pm
    #1
    Registered Users Posts: 632 ✭✭✭


    Hi, I'm not too familiar with javascript but I just downloaded a free script for a scrolling marquee and placed it into a div in my html. It works great, I was even able to style it using my linked external css file.

    I though I might be able to save the script in an external file and place a link to it from within the div. Reason is, it will be on every page of the site and I want to be able to update the content easily.

    I tried the following;

    <script type="text/javascript" language="javascript" src="(../path/to/ file.js)"></script>

    but no joy :(

    Am I doing something wrong here? Thanks.


Comments

  • Registered Users Posts: 3,886 ✭✭✭cgarvey


    you might want to copy it to the same folder as the HTML file that's calling it, to eliminate path (virutal or OS) issues, as a starting point, then use your script tag
    <script type="text/javascript" src="myjsfile.js"></script>
    

    If that still doesn't work, try loading the JS file in your browser directly (as in, in the address bar type http://whatever/myfolderwithHTMLfile/myjsfile.js) to make sure it can be read.

    .cg


  • Registered Users Posts: 632 ✭✭✭ButtermilkJack


    Hey cgarvey, thanks for the quick reply! I tried the first option, placing the js file in the same folder and no joy. I'm now trying to upload the js to the server to try your second suggestion but I'm having problems connecting to server through dreamweaver.

    I just installed bb modem and wireless router so I think it could be a firewall issue. I'm useless at those so it could be a while before you hear from me :o

    Thanks so far :D


Advertisement