Javascript Tutorials
Introduction to AJAX
Javascript Form Validation
Javascript Fundamentals

Javascript Fundamentals

Basics

Embedded javascript with a <SCRIPT> tag and end with </SCRIPT>. It is recommended that you include type and language statements inside the script tag, <SCRIPT TYPE="text/javascript" LANGUAGE="Javascript_version">. The SRC attribute can be used in the script tag to include a separate file containing the script, like <SCRIPT TYPE="text/javascript" LANGUAGE="Javascript_version" SRC="javascript.js">. <NOSCRIPT> is an alternative for non javascript capable browsers. By default scripts are executed as the page loads.

Code comments are started with // if they are single line. Multi line comments are started with /* and ended with */. Use HTML comment statements <!- and //--> to hide your javascript from browsers that don't support javascript. Buttons are created with basic HTML form structure.

Example:
<FORM>
<INPUT TYPE="BUTTON" NAME="Example" VALUE="Example">
</FORM>

Variables

It is recommended to declare variables in the <HEAD> section of the page. var command is used to declare variables.

<SCRIPT TYPE="text/javascript" LANGUAGE="Javascript_1.2">
var variableName=3
var variableName=5.23
var variableName="String goes here"
</SCRIPT>

The examples above set the variable variableName to 3 then 5.23 and finally to "String goes here".

 1 2 3 4 5  >> Arrays
New Content