homepage Welcome to WebmasterWorld Guest from 54.166.159.110
register, free tools, login, search, pro membership, 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

WebmasterWorld Senior Member keyplyr us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 58 posted 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

10+ Year Member



 
Msg#: 58 posted 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

WebmasterWorld Senior Member keyplyr us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 58 posted 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

10+ Year Member



 
Msg#: 58 posted 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

WebmasterWorld Senior Member keyplyr us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 58 posted 1:59 am on Feb 18, 2002 (gmt 0)

That's working just fine Black_Knight
Thanks again

Black Knight

10+ Year Member



 
Msg#: 58 posted 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