<%response.buffer=true%> <% Response.Expires = 0 %> JavaScript Intro

Example Files

Below are links to example files that we have built in class.  If You click on the file name, you can see an example of the file in action.  Click on the word SOURCE to open a word document showing the source code for the file.

File Name Function Notes/Source
Shows current year as part of page copyright.

Include this in a JS include file and keep all your pages up to date. SOURCE

Shows date in mm/dd/yyy format. Example of if/then syntax. SOURCE
Image/color/messages change based on hour of day. (Harnesses system clock) Demos if/else statement, document.bgColor, document.write.
Switches page content based on date (1-31, etc). Rotates content based on modulus. Demos switch statement, modulus operator.
Uses window.open to popup a page into a new window. Demos custom functions to vary window size, document location via anchor tags.
Demonstrates properties of the navigator object, and for/in looping example. Knowing the browser of the user can allow custom styles, etc.
Demonstrates various ways to create a "rollover" image effect. As long as your images are pre-loaded, how you roll the images is up to you!
Determines current page to create dynamic link navigation example.

Uses href property of location object, string handling and parallel arrays to tailor page navigation. SOURCE

We adapted the browser sniffer in class to demonstrate how to adapt code with a form, and a JS Function. Knowing the properties and methods of various objects on a page helps us learn JS.
huey.htm A simple array example. A basis for next example (SplitNephews). SOURCE
SplitNephews.htm Splits a comma separated form element value in an array, and prints to the screen. Shows use of split function, and innerHTML. SOURCE
randomQuotes.htm Generates random quotes from an array built in JS. Uses an array as a data source. SOURCE
formElements.htm Displays all names & current values of an example form. Loops through all form elements. SOURCE
checkForm.htm A simple example for requiring all text boxes on a form. Only works for text boxes (type=text). SOURCE
simpleEmailCheck.htm A simple example requiring some specific email characters from a text box. A simple example of string handling on a form. SOURCE
illChars.htm Disallows certain characters from a text box on a form. The string of illegal chars is hard wired into a function. SOURCE
regExSoc.htm Uses a regular expression to determine a valid Soc. Sec Number. The regEx function is the same, with a different matching string! SOURCE
regExEmail.htm Uses a regular expression to determine a valid email address. The regEx function is the same, with a different matching string! SOURCE
checkFruit.htm Provides feedback to user about checkbox selections Advanced string handling and a checkbox element. SOURCE
checkReq.htm Allows the developer to establish required and optional elements Place a letter "x" before the name of a required element. SOURCE


Print this Page Back To Top

2000- <%=year(date)%> newMANIC INC, All rights reserved