PDA

View Full Version : External Javascript files Question


adamWeiler
07-04-2007, 04:11 PM
I have 4 Javascript functions;
one for the date, one to open a new window, one with an alert message, and one for a photograph slideshow. The first three are accessible on all my pages, and the last one is used on only one page.

Right now, each of these functions is in a seperate file, and it's kind-of bulky in the <head> section.

I'm wondering if:
-I should put all of the functions in the same file.
OR -is there a way to link to all four files all at once.
Something like this?: <script type="text/javascript" src="javascript/1.js, 2.js, 3.js, 4.js"> </script>

RysChwith
07-05-2007, 08:21 AM
There's no way to link to them all at once, as far as I know.

You could certainly put them all in one file (although I'd consider leaving the fourth one in its own file). The only compelling reason to keep them separately is to be able to edit each one individually without affecting the others. If you can trust yourself to not muck things up, combining them shouldn't pose a problem.

Rys

adamWeiler
07-05-2007, 09:42 AM
Okay; thanx.

I'm actually used to working with all the Javascript and functions in the same file, also with the Html. These external files are something new to me.