Free Webmaster Resources .info
PHP Introduction and Tutorials Javascript  Introduction and Tutorials HTML  Introduction and Tutorials ASP  Introduction and Tutorials Free Internet Access Guide and Directory Webspace  Directory Webhosting  Directory Adult Webhosting  Directory PHP Hosting  Directory ASP Hosting  Directory
à Navigation
» Home
» Javascript Introduction
» Javascript Tutorial
» Javascript Library
» Submit Scripts
 
Subscribe for free!

Join our mailing list today and recieve free updates monthly with web hosting specials!
 
 

 

 

Free Webmaster Resources .info | Javascript Tutorials

Embedding JavaScript Functions
JavaScript Grammar Objects
Variables and Data Types Event Handlers
Operators Conclusion
Statements  

JavaScript Tutorial for Programmers - Embedding Javascript


JavaScript code is typically embedded into an HTML document using the SCRIPT tag. You are free to embed as many scripts into a single document as you like, using multiple SCRIPT tags. A script embedded in HTML with the SCRIPT tag uses the format:

<script language="JavaScript">
<!--
document.write("Hello World!");
//-->
</script>

The LANGUAGE attribute is optional, but recommended. You may specify that a section of code only be executed by browsers which support a particular version of JavaScript; for instance:

<script language="JavaScript1.2">

Another attribute of the SCRIPT tag, SRC, can be used to include an external file containing JavaScript code rather than code embedded into the HTML:

<script language="JavaScript" src="corefunctions.js">
</script>

The external file is simply a text file containing JavaScript code, and whose filename ends with the extension ".js". Note that although some version 3 browsers support the SRC attribute, it only functions reliably across platforms in the version 4 browsers.

Scripts can be placed inside comment fields to ensure that your JavaScript code is not displayed by old browsers that do not recognize JavaScript. The markup to begin a comment field is <!-- while you close a comment field using //-->. This practice is certainly optional, but considered good form when your page is likely to be visited by older browsers. Certainly, as older browsers fade away, this practice will likely become unnecessary.



Recommended Webhosting Company
Domain Names
Looking to find domain names? Visit our domain names guide.

 

 
Related Websites
 


Free Email
Your source to free email.

Free Casino Downloads
Contains useful free casino downloads.

Free Software Downloads
A complete collection of free software downloads.

Free
Download free stuff from psike.com your free stuff resource.

Free Teen Online Dating
Meet other singles for free online dating.

Coolfreeweb.com
The Free category at coolfreeweb.com

My Directory Listing
A massive directory listing of websites

Website Collation Project
The website collation project contains a huge directory of websites.


 
Top Webhosts
 
 1. Domain Names
 2. Domain Name Registratio
 3. Websites Hosting
 4. Find free web hosting
 5. Free Web Hosting
 
-
- Give us feedback
 
Last updated
Oct 11, 2008
Free Webmaster Resources .info | A resource must for every web master
Untitled Document - Web Hosting
- PHP Hosting
- Free Internet Access