Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

Linking to 'external.js' file

  • 29-07-2005 11:25AM
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 Posts: 3,890 ✭✭✭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, Registered Users 2 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