Learn the Basics of JavaScript
JavaScript is a set of instructions that tells a program
(like a browser or word processor) how to automate a task. (Example: A Mail Merge
in your word processor). JavaScript was created by Netscape. JavaScript is the
only Scripting Language supported by all popular browsers. It is the POWER behind
DHTML. DHTML is a way to modify HTML after it is in the browser. This is achieved
using JavaScript.
JavaScript is NOT Java. (JAVA was created by
Sun Systems). Microsoft created their own version of JavaScript and they call it
"JScript". JavaScript and JScript are identical, only the names are different! JavaScript
looks different in Netscape than it does in Internet Explorer!
You write JavaScript using NOTEPAD or any WYSIWYG editor. The <SCRIPT> tag can
be inserted anywhere in the HTML page (top, middle, bottom). To avoid users
getting an error by clicking an item on a web page that has JavaScript attached
to it, most developers place the <script> tags in the HEAD section of the HTML
because it loads before anything else in the page. The basics of javaScript can
be read below.
Link to an external JavaScript File with this code:
<script language="Javascript" src="js/NSresizefix.js"
type="text/javascript" />
Basic Syntax:
<script language="JavaScript"
type="text/javascript">
<!--Hide from old browsers
//Comments
function
NameofFunction( )
{
a line of Javascript;
another line of Javascript;
more lines of Javascript;
}-->
</script>
Comments:
Comments in JavaScript are written inbetween these special characters <!-- //-->
JavaScript IS an object oriented programming language:
An OBJECT is a collection of Properties, Methods and Events.
(A textbox is an object. A button is an object.)
A PROPERTY is an attribute describing the object (example: size, color, modelnumber, id*)
* The id gives the object a UNIQUE name of identifying it
(id and name are the same...use both because of the dift browsers
and dift. versions of those browsers.)(id=txtMyStuff name = txtMyStuff)
A METHOD is something an object does. (Methods are "functions")
Code Sytnax for methods look like this:
open( )
close( )
select( )
scroll( )
Resources:
JavaScript
Kit | CodingForums.com
JavaScript is a web programming language that can be written in any text editor
and savd with the file extension of .js. JavaScript is a client-side language
which means that it runs on the users' computer rather than on the machine where
the file resides. JavaScript is not a full blown web programming language but
instead a script file that can perform small functions. There are many good uses
to use JavaScript and you can view a few examples below.
All of the examples below link to HTML pages. To see the actual javaScript code for each
of these functions, once you click on a link below a web page will open in the
web browser. Simply right-click to view the source code.
Open Dialog Boxes:
Alert Box
Prompt
Print It
Displaying Dynamic Elements on the Page:
Display Date
If / Then Statements
Moving Elements on the Page:
Falling Images
Create Fly Out Effect
Timed Slideshow
Browser Detection:
Browser Redirect
-one page for IE, one page
for Firefox