/    Sign up×
Community /Pin to ProfileBookmark

Including multiple javascript files in one?

I need to update a large 1,000+ page site with additional js files on every page. I had to do this recently already and it is a very time consuming process since all pages have to go back through Sourcesafe and QA.

Is there a way to have one javascript include file in the header that calls all of the other javascript files?

thanks

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51May 19.2005 — best thing would be to use a server side include....

You could have a js file that writes out the other js files onto the page, but I see that as been messy.

You could also jus have one big js file with all the functions...

Eric
Copy linkTweet thisAlerts:
@eslaydonauthorMay 19.2005 — Thank you Eric,

I was afraid that placing a SSI in the header would keep my pages from validating and wanted to make sure I wasn't overlooking a simple js fix. It sounds like the easiest fix though.

Eugenia
Copy linkTweet thisAlerts:
@A1ien51May 19.2005 — your js files do not have to be in the header, you can place them in the body too.
Copy linkTweet thisAlerts:
@ajimenezJun 24.2005 — Hi...

I'm not quite sure if eslaydon's question was answered, at least not to me ? .

Is it possible to call multiple javascript files with only one javascript file?? If so, how would the code look like?

Your guys' discussion seems to imply that this isn't the best way of doing things but I would like to know if it's possible of doing it using one javascript file.
Copy linkTweet thisAlerts:
@Tweak4Jun 24.2005 — You could declare the new js file from inside one of the existing ones using a document.write("<script type='text/javascript' src='whatever.js'></script>"). It's not really [I]generally accepted[/I], but it'll work in a pinch, and you'd only have to make the change in one place. I wouldn't consider it a permanant solution, but if you're in a hurry, it would at least buy you a little time to go through and set up something better...
Copy linkTweet thisAlerts:
@ajimenezJun 24.2005 — Thank you, Tweak...

That's pretty much what I needed ?
Copy linkTweet thisAlerts:
@felgallJun 24.2005 — Why not just copy all of the Javascripts to go in the head section into ONE Javascript file. There is no need for multiples unless some are only to be included on certain pages.
×

Success!

Help @eslaydon spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...