Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

The JavaScript FAQ
Prev Home Next

External JS Files

Question: Can I include JavaScript code from external JS files, rather than embedding all my scripts within HTML pages?

Answer: Yes. To do so, create a new file with the extension .js, for example, myscript.js. Put your JavaScript code in this file; do not include opening and closing SCRIPT tags in the .js file!

To embed myscript.js into your Web page, use these tags in your HTML file:

<SCRIPT LANGUAGE="JavaScript" SRC="myscript.js">
</SCRIPT>
In practice, you might find it convenient to create .js files containing JavaScript functions that you reuse on many different HTML pages. Please note, however, that some old browsers (e.g. Navigator 2.x and Explorer 3.x) cannot load external JavaScript files!

JavaScripter.net. Copyright © 1999-2006, Alexei Kourbatov

The JavaScript FAQ
Prev Home Next


 
 
  Mirrored with kind permission of Alexei Kourbatov Design by Interspire