homepage Welcome to WebmasterWorld Guest from 54.226.93.128
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
JavaScript Tags
multiple external scripts called from 1 tag?
keyplyr




msg:1477214
 7:20 am on Feb 17, 2002 (gmt 0)

Can multiple external JavaScripts, including one with a different lang type, be called from inside one tag? In other words, can this:

<script type="text/javascript" language="JavaScript"
src="/scripts/script1.js"></script>
<script language="JavaScript" type="text/javascript" src="/scripts/script2.js"></script>
<script language="JavaScript" src="/scripts/script3.js"></script>
<script language="JavaScript" type="text/javascript" src="/scripts/script4"></script>
<script language="JavaScript1.2" type="text/javascript"
src="/scripts/script5.js"></script>

... be written something like:

<script type="text/javascript"
language="JavaScript"
src="/scripts/script1.js" ;
src="/scripts/script2.js" ;
src="/scripts/script3.js" ;
src="/scripts/script4.js" ;
language="JavaScript1.2"
src="/scripts/script5.js"></script>

and if so, can it be even more concise?

 

Black Knight




msg:1477215
 12:59 pm on Feb 17, 2002 (gmt 0)

No. One source (SRC) attribute per tag only.

To combine javascripts, put all of the javascript into a single .js file.

Alternately you can 'fudge' it by creating a javascript to write in all the other javascript tags.

Ammon Johns

keyplyr




msg:1477216
 8:54 pm on Feb 17, 2002 (gmt 0)

Terrific,

How would I seperate the scripts if they were all on the one external file?

Black Knight




msg:1477217
 10:58 pm on Feb 17, 2002 (gmt 0)

If they use the same language and version, there is no need to separate them at all, just define all the functions for all the scripts in one single big bite.

In other words, paste the contents of each .JS file, one after the other, into a single .JS file.

To fudge it just use one external JavaScript that uses the write() method to write-in all the other JavaScript calls

e.g.

document.write('<SCRIPT LANGUAGE="JavaScript" SRC="scripts/script1.js"> </SCRIPT>');
document.write('<SCRIPT LANGUAGE="JavaScript" SRC="scripts/script2.js"> </SCRIPT>');
document.write('<SCRIPT LANGUAGE="JavaScript" SRC="scripts/script3.js"> </SCRIPT>');
document.write('<SCRIPT LANGUAGE="JavaScript" SRC="scripts/script4.js"> </SCRIPT>');

keyplyr




msg:1477218
 1:59 am on Feb 18, 2002 (gmt 0)

That's working just fine Black_Knight
Thanks again

Black Knight




msg:1477219
 8:16 am on Mar 5, 2002 (gmt 0)

Glad to have been of help.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved