|
Subject:
|
External JS files
|
|
Posted By:
|
Ben Horne
|
Post Date:
|
4/12/2004 4:08:35 PM
|
Hi all,
If I wanted to put all of my Javascript code in a separate JS file and reference that in a web page, how would I need to reference the JS file?
Ben Horne Madison Area Technical College student
------------------------- http://community.webshots.com/user/valerian114
Go there. I have a lot of awesome photos that I rendered myself
"There are two kinds of people in the world: Those who claim to be Flash junkies and those who actually are Flash junkies"
|
|
Reply By:
|
PortGuy
|
Reply Date:
|
4/12/2004 4:15:18 PM
|
Simple, Ben, as follows:
<head> <script language="JavaScript" src="/my_global_dir/my_global_js_file.js"></script> </head>
Within your external JavaScript file, you do not use the <script> tag, but simply type the code without the opening and closing <script> tags.
And by the way, most developers recommend using external JS files when you are re-using many of the functions.
|
|
Reply By:
|
Snib
|
Reply Date:
|
4/12/2004 4:15:53 PM
|
I like using external .js files because when you want to change the script for a web page, modifying the .js document is like changing all the pages that link to it at once.
The above solution should work perfectly for you.
HTH,
Snib
P2P Member <><
|
|
Reply By:
|
beetle_jaipur
|
Reply Date:
|
7/25/2008 2:00:49 AM
|
thanks friend, that little statement "you do not use the <script> tag" helped me to resolve my error
thanks
ashok
|