• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

moving javascript to an external file

Dubb

Platinum Member
Yes, I know, stupid noob question. I'm just getting started in learning web design, and seem to have run into a snag.

I setup a navbar for the site I'm working on (uses mouseover buttons, etc), and noticed that since this navbar appears on every page in the site, it might be a good idea to move the javascript portion to an external file to make things a bit more tidy/efficient.

Basically:

I created a js_files directory, created a navbar.js file, snipped out the code, and pasted into navbar.js.

then, where the code used to be, I did this

which as far as I can tell is correct, but the functions don't work. Help?
 
Try inserting the following line somewhere between the <HEAD> and </HEAD> tags: <SCRIPT TYPE="text/javascript" SRC="./js_files/functions.js"></SCRIPT>

-Tom
 
ah, ok, I copied the <script type=.... stuff into the .js file as well. I'm dumb.

print design is so much easier.
 
Originally posted by: Soccer55
Try inserting the following line somewhere between the <HEAD> and </HEAD> tags: <SCRIPT TYPE="text/javascript" SRC="./js_files/functions.js"></SCRIPT>

-Tom
FTW!! this example is standards compliant 🙂
 
Back
Top