Welcome to WebmasterWorld Guest from 54.226.183.49

Forum Moderators: open

Message Too Old, No Replies

JavaScript Tags

multiple external scripts called from 1 tag?

     

keyplyr

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

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



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

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

10+ Year Member



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

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

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



Terrific,

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

Black Knight

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

10+ Year Member



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

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

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



That's working just fine Black_Knight
Thanks again

Black Knight

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

10+ Year Member



Glad to have been of help.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month