Chris Rathman / Chris.Rathman@tx.rr.com

<!--*********************************************************************
 *                                                                      *
 * Sample JavaScript Program                                            *
 *                                                                      *
 **********************************************************************-->

<html>
<head>
<title>JavaScript</title>

<!--*********************************************************************
 *                                                                      *
 *   Reserved Words:                                                    *
 *                                                                      *
 *      JavaScript:                                                     *
 *         break           else            in              this         *
 *         case            false           new             typeof       *
 *         continue        for             null            var          *
 *         default         function        return          while        *
 *         delete          goto            switch          with         *
 *         do              if              true                         *
 *                                                                      *
 *      Java Not Used:                                                  *
 *                                                                      *
 *         abstract        final           native          synchronized *
 *         boolean         finally         package         throw        *
 *         byte            float           private         throws       *
 *         catch           implements      protected       transient    *
 *         char            import          public          try          *
 *         class           instanceof      reset           void         *
 *         const           int             short           (volatile)   *
 *         double          interface       static                       *
 *         extends         long            super                        *
 *                                                                      *
 **********************************************************************-->

<!--*********************************************************************
 *                                                                      *
 * Hiding from non-script browsers:                                     *
 *                                                                      *
 **********************************************************************-->
<script language="JavaScript">
<!--
    /* Hidden from old browsers.*/
//-->
</script>
<noscript>
    Hidden From script-enabled browsers.
</noscript>

<!--*********************************************************************
 *                                                                      *
 * Include Files                                                        *
 *                                                                      *
 **********************************************************************-->
<script language="JavaScript" src="jsinclude.js">
</script>

<script language="JavaScript">
/************************************************************************
 *                                                                      *
 * Constants:                                                           *
 *                                                                      *
 ************************************************************************/
var TRUE = 1;
var FALSE = 0;
var DEBUG = TRUE;
var PI = 3.14;
var PISQUARE = PI*PI;

/************************************************************************
 *                                                                      *
 * Global Variables:                                                    *
 *                                                                      *
 ************************************************************************/
var gseg;
var xseg = 1234;

/************************************************************************
 *                                                                      *
 * HTML Entry Point:                                                    *
 *                                                                      *
 ************************************************************************/
document.write("Hello World!<br>");

</script>
</head>
<!--*********************************************************************
 *                                                                      *
 * Document Level Events:                                               *
 *                                                                      *
 **********************************************************************-->
<body
   onblur="rs('onblur(window NC3)')"
   ondragdrop="rq('ondragdrop(window)')"
   onerror="rq('onerror(window)')"
   onfocus="rs('onfocus(window NC3)')"
   onload="rs('onload(window NC3)')"
   onmove="rs('onmove(window NC4)')"
   onresize="rs('onresize(window NC4)')"
   onunload="rs('onunload(window NC3)')">

<script language="JavaScript">

/************************************************************************
 *                                                                      *
 * Storage Types:                                                       *
 *                                                                      *
 ************************************************************************/
function StorageTypes() {
   var gseg = 1234;              // variables are either global or local in scope
   var x;

   x = 1;                        // type assignment is automatic
   x = 2.2;
   x = "3"
   x = true;
   x = null;
   x = navigator;
   x = alert;

   document.write("<br><hr><br><u>Storage Types</u><br>");
   document.write("typeof(1) = " + typeof(1) + "<br>");
   document.write("typeof(2.2) = " + typeof(2.2) + "<br>");
   document.write("typeof(\"3\") = " + typeof("3") + "<br>");
   document.write("typeof(true) = " + typeof(true) + "<br>");
   document.write("typeof(NothingAtAll) = " + typeof(NothingAtAll) + "<br>");
   document.write("typeof(null) = " + typeof(null) + "<br>");
   document.write("typeof(alert) = " + typeof(alert) + "<br>");
   document.write("typeof(navigator) = " + typeof(navigator) + "<br>");
}
StorageTypes();

/************************************************************************
 *                                                                      *
 * Operators:                                                           *
 *                                                                      *
 *         []  array subscript          ==  equal                       *
 *          .  class member             !=  not equal                   *
 *         ()  call                      &  bitwise and                 *
 *          !  logical not               ^  bitwise xor                 *
 *          ~  one's complement          |  bitwise or                  *
 *          +  unary plus               &&  logical and                 *
 *          -  unary minus              ||  logical or                  *
 *         ++  increment                ?:  conditional if?then:else    *
 *         --  decrement                 =  assign                      *
 *     (type)  type cast                *=  compound assign             *
 *          *  multiply                 /=                              *
 *          /  divide                   %=                              *
 *          %  modulus                  +=                              *
 *          +  add                      -=                              *
 *          -  subtract                 &=                              *
 *         <<  left shift               ^=                              *
 *         >>  right shift              |=                              *
 *        >>>                          <<=                              *
 *          <  less than               >>=                              *
 *         <=  less than or equal     >>>=                              *
 *          >  greater than              ,  comma                       *
 *         >=  greater than or equal                                    *
 *                                                                      *
 ************************************************************************/
function Operators() {
   var b=0;
   var i=0;
   var j=0;
   var x=0;

   i = 5;                        // simple assignment: i = 1;
   i = j = 3;                    // compound assignment: j = 3; i = j;
   i = (j = 1) + 2;              // parenthesis precedence: j = 1; i = j + 2;

   i = 3 + 2;                    // add: i = 5;
   i = (5) % (3);                // mod: i = 2;

   i = ++j;                      // pre-increment: j = j + 1; i = j;
   i = --j;                      // pre-decrement: j = j - 1; i = j;
   i = j++;                      // post-increment: i = j; j = j + 1;
   i = j--;                      // post-decrement: i = j; j = j - 1;

   i += j;                       // i = i + j;
   i -= j;                       // i = i - j;
   i *= j;                       // i = i * j;
   i /= j;                       // i = i / j;
   i %= j;                       // i = i % j;
   i <<= j;                      // i = i << j;
   i >>= j;                      // i = i >> j;
   i >>>= j;                     // i = i >>> j;
   i &= j;                       // i = i & j;
   i ^= j;                       // i = i ^ j;
   i |= j;                       // i = i | j;

   b = (i == 0);                 // equal
   b = (i < 0);                  // less than
   b = (i <= 0);                 // less than or equal
   b = (i > 0);                  // greater than
   b = (i >= 0);                 // greater than or equal
   b = (i != 0);                 // not equal

   i = j & 1;                    // bitwise and
   i = j ^ 1;                    // bitwise xor
   i = j | 1;                    // bitiwise or

   if (i === i) alert("A");      // identity operator added in 1.3
}
Operators();

/************************************************************************
 *                                                                      *
 * Built-In Functions:                                                  *
 *                                                                      *
 ************************************************************************/
function BuiltIn() {
   var i;
   var x;
   var s;
   var b;

   i = parseInt("3.14", 10);     // cast operator: i = 3;
   x = parseFloat("3");          // cast operator: x = 3.0;
   i = eval("3 * 2");            // cast operator: i = 6;
   s = escape("ab ?>");          // return encoding value of string: s = "ab%20%3F%3E";
   s = unescape("ab%20%3F%3E");  // unencode value of string: s = "ab ?>";
   b = isNaN(i);                 // test if is not-a-number

   /* taint() */
   /* untaint() */
}
BuiltIn();

/************************************************************************
 *                                                                      *
 * Flow Control:                                                        *
 *                                                                      *
 ************************************************************************/
function FlowControl() {
   var i = 0;
   var j = 0;
   var b = false;

   if (b) {                      // if then else
      j = 1;
   } else {
      j = 2;
   }

   while (i != 0) {              // while loop
      i = i - 1;
      if (b) continue;
      break;
   }

   for (i = 0; i < 4; i++) {     // for loop
      j = j + 1;
      if (b) continue;
      break;
   }

   for (i in navigator) {        // for-in loop
      j = j + 1
      if (b) continue;
   }

   for (x in document) {
      document.write(x + "<br>");
   }

   i = b ? 1: 2;                 // if then else ternary
   b ? i=1: i=2;

   /* do while, switch case, and break label only available on NC4 1.2
   do {                          // do while loop
      i = i + 1;
      break;
      if (b) continue;
   } while (i < 10);

   switch (i) {                  // switch case
      case 0:
         j = 1;
         break;
      default:
         j = 3;
         break;
   }

   mybreak1: while (i != 0) {    // labelled break/continue
      break mybreak1;
      continue mybreak1;
   } */
}
FlowControl();

document.write("<br><hr><br><u>Event Handlers</u>");
</script>
<!--*********************************************************************
 *                                                                      *
 * event handlers:                                                      *
 *                                                                      *
 *    JavaScript1.0                                                     *
 *         onblur          onfocus         onmouseover     onsubmit     *
 *         onchange        onload          onselect        onunload     *
 *         onclick                                                      *
 *                                                                      *
 *    JavaScript1.1                                                     *
 *         onabort         onerror         onmouseout      onreset      *
 *                                                                      *
 *    JavaScript1.2                                                     *
 *         ondragdrop      onkeyup         onmousemove     onmove       *
 *         onkeydown       onmousedown     onmouseup       onresize     *
 *         onkeypress                                                   *
 *                                                                      *
 **********************************************************************-->
<form
   name="myForm"
   onsubmit="rs('onsubmit(form)')"
   onreset="rs('onreset(form 1.1)')">

<!-- anchor event handlers -->
<a href="javascript.htm"
   name="myAnchor"
   onblur="rs('onblur(anchor IE4)')"
   onfocus="rs('onfocus(anchor IE4)')"
   onkeydown="rq('onkeydown(anchor NC4)')"
   onkeypress="rq('onkeypress(anchor NC4)')"
   onkeyup="rq('onkeyup(anchor NC4)')"
   onmousedown="rs('onmousedown(anchor 1.2)')"
   onmouseout="rs('onmouseout(anchor 1.1)')"
   onmouseover="rs('onmouseover(anchor 1.0)')"
   onmouseup="rs('onmouseup(anchor IE4)')">Anchor Me</a><br>

<!-- button event handlers -->
<input
   type="button"
   name="myButton"
   value="Click Me"
   onblur="rs('onblur(button 1.1)')"
   onclick="rs('onclick(button 1.0)')"
   onfocus="rs('onfocus(button 1.1)')"
   onmousedown="rs('onmousedown(button 1.2)')"
   onmouseup="rs('onmouseup(button 1.2)')"
   onmouseover="rs('onmouseover(button IE4)')"><br>

<!-- checkbox event handlers -->
<input
   type="checkbox"
   name="myCheckBox"
   checked
   onblur="rs('onblur(checkbox 1.1)')"
   onclick="rs('onclick(checkbox 1.0)')"
   onfocus="rs('onfocus(checkbox 1.1)')"
   onmousedown="rs('onmousedown(checkbox IE4)')"
   onmouseup="rs('onmouseup(checkbox IE4)')"
   onmouseover="rs('onmouseover(checkbox IE4)')">CheckBox Me<br>

<!-- file event handlers -->
<input
   type="file"
   name="myFile"
   value="File Me"
   onblur="rs('onblur(file 1.1)')"
   onchange="rs('onchange(file 1.0)')"
   onclick="rs('onclick(file 1.0)')"
   onfocus="rs('onfocus(file 1.1)')"
   onmousedown="rs('onmousedown(file 1.2)')"
   onmouseover="rs('onmouseover(file IE4)')"
   onmouseup="rs('onmouseup(reset 1.2)')"><br>

<!-- hidden event handlers -->
<input
   type="hidden"
   name="myHidden"
   value="Hidden Me">

<!-- image event handlers -->
<img
   src="img1.gif"
   name="myImage"
   height="25"
   width="25"
   onabort="rq('onabort(image 1.1)')"
   onblur="rq('onblur(image 1.1)')"
   onclick="rq('onclick(image 1.0)')"
   onerror="rq('onerror(image 1.1)')"
   onfocus="rq('onfocus(image 1.1)')"
   onkeydown="rq('onkeydown(image 1.2)')"
   onkeypress="rq('onkeypress(image 1.2)')"
   onkeyup="rq('onkeyup(image 1.2)')"
   onmousedown="rs('onmousedown(image 1.2)')"
   onmouseup="rs('onmouseup(image 1.2)')"
   onmouseover="rq('onmouseover(image IE4)')">

<!-- password event handlers -->
<input
   type="password"
   name="myPassword"
   value="Password Me"
   onblur="rs('onblur(password 1.1)')"
   onchange="rs('onchange(password IE4)')"
   onfocus="rs('onfocus(password 1.1)')"
   onmousedown="rs('onmousedown(password IE4)')"
   onmouseover="rs('onmouseover(password IE4)')"
   onmouseup="rs('onmouseup(password IE4)')"
   onselect="rs('onselect(password IE4)')"><br>

<!-- radio event handlers -->
<input
   type="radio"
   name="myRadio"
   value="radio1"
   checked
   onblur="rs('onblur(radio 1.1)')"
   onclick="rs('onclick(radio 1.0)')"
   onfocus="rs('onfocus(radio 1.1)')"
   onmousedown="rs('onmousedown(radio IE4)')"
   onmouseover="rs('onmouseover(radio IE4)')"
   onmouseup="rs('onmouseup(radio IE4)')">Radio Me #1
<input
   type="radio"
   name="myRadio"
   value="radio2"
   onblur="rs('onblur(radio 1.1)')"
   onclick="rs('onclick(radio 1.0)')"
   onfocus="rs('onfocus(radio 1.1)')"
   onmousedown="rs('onmousedown(radio IE4)')"
   onmouseover="rs('onmouseover(radio IE4)')"
   onmouseup="rs('onmouseup(radio IE4)')">Radio Me #2<br>

<!-- reset event handlers -->
<input
   type="reset"
   name="myReset"
   value="Reset Me"
   onblur="rs('onblur(reset 1.1)')"
   onclick="rs('onclick(reset 1.0)')"
   onfocus="rs('onfocus(reset 1.1)')"
   onmousedown="rs('onmousedown(reset IE4)')"
   onmouseover="rs('onmouseover(reset IE4)')"
   onmouseup="rs('onmouseup(reset IE4)')"><br>

<!-- select drop-down event handlers -->
<select
   name="mySelect"
   onblur="rs('onblur(select 1.1)')"
   onclick="rs('onclick(select 1.0)')"
   onfocus="rs('onfocus(select 1.1)')"
   onmousedown="rs('onmousedown(select IE4)')"
   onmouseover="rs('onmouseover(select IE4)')"
   onmouseup="rs('onmouseup(select IE4)')">
<option value="myItem1">Item1
<option value="myItem2">Item2
<option value="myItem3">Item3
<option value="myItem4">Item4
<option value="myItem5">Item5
</select><br>

<!-- select list event handlers -->
<select
   name="mySelect"
   size="3"
   multiple
   onblur="rs('onblur(select 1.1)')"
   onclick="rs('onclick(select 1.0)')"
   onfocus="rs('onfocus(select 1.1)')"
   onmousedown="rs('onmousedown(select IE4)')"
   onmouseover="rs('onmouseover(select IE4)')"
   onmouseup="rs('onmouseup(select IE4)')">
<option value="myItem1">Item1
<option value="myItem2">Item2
<option value="myItem3">Item3
<option value="myItem4">Item4
<option value="myItem5">Item5
</select><br>

<!-- submit event handlers -->
<input
   type="submit"
   name="mySubmit"
   value="Submit Me"
   onblur="rs('onblur(submit 1.1)')"
   onclick="rs('onclick(submit 1.0)')"
   onfocus="rs('onfocus(submit 1.1)')"
   onmousedown="rs('onmousedown(submit IE4)')"
   onmouseover="rs('onmouseover(submit IE4)')"
   onmouseup="rs('onmouseup(submit IE4)')"><br>

<!-- text event handlers -->
<input
   type="text"
   name="myText"
   value="Text Me"
   onblur="rs('onblur(text 1.0)')"
   onchange="rs('onchange(text 1.0)')"
   onfocus="rs('onfocus(text 1.0)')"
   onmousedown="rs('onmousedown(text IE4)')"
   onmouseover="rs('onmouseover(text IE4)')"
   onmouseup="rs('onmouseup(text IE4)')"
   onselect="rs('onselect(text 1.0)')"><br>

<!-- textarea event handlers  (WRAP=SOFT/HARD/NONE???) -->
<textarea
   name="myTextArea"
   cols="20"
   rows="3"
   wrap="virtual"
   onblur="rs('onblur(textarea 1.0)')"
   onchange="rs('onchange(textarea 1.0)')"
   onfocus="rs('onfocus(textarea 1.0)')"
   onkeydown="rs('onkeydown(textarea 1.2)')"
   onkeypress="rs('onkeypress(textarea 1.2)')"
   onkeyup="rs('onkeyup(textarea 1.2)')"
   onmousedown="rs('onmousedown(textarea IE4)')"
   onmouseover="rs('onmouseover(textarea IE4)')"
   onmouseup="rs('onmouseup(textarea IE4)')"
   onselect="rs('onselect(textarea 1.0)')">TextArea Me</TEXTAREA><br>

<script language="JavaScript">
/************************************************************************
 *                                                                      *
 * Objects:                                                             *
 *                                                                      *
 ************************************************************************/
function makeObject(a, b) {
   this.a = a;                   // properties
   this.b = b;
   this.rs = rs;                 // methods
}

function Objects() {
   var mob = new makeObject(1, 2);           // allocate new object
   var nob = { x: 15, y: 25, radius: 8 };    // object literal

   mob.c = 4;                    // dynamic property creation
   mob.a += 1;                   // accessing props/methods by name
   mob.b += 1;
   mob.c += 1;
   mob.rs("objects");

   mob['a'] += 1;                // accessing properties by index
   mob['b'] += 1;
   mob['c'] += 1;

   with (mob) {                  // with object construct
      a += 1;
      b += 1;
      c += 1;
   }
   delete mob;

}
Objects();

/************************************************************************
 *                                                                      *
 * Function Object:                                                     *
 *                                                                      *
 *    Properties:                                                       *
 *         caller          prototype                                    *
 *                                                                      *
 *    Collections:                                                      *
 *         arguments[i]                                                 *
 *                                                                      *
 ************************************************************************/
function objFunction() {
   var s;

   /* Function properties */
   Function.prototype.myProto = "hello"

   s = objFunction.caller;                         // calling function name
   for (var i = 0; i < arguments.length; i++) {
      s = objFunction.arguments[i];                // get variable function parameters
   }

   /* allocating new functions */
   var myFunction = new Function("x", "y", "return(x+y);");
   i = myFunction(2);
   document.myForm.myButton.onmouseover = new Function("rs('onmouseover(function)');");

   /* Lambda functions */
   var square = function(x) { return x * x; }
}
objFunction("a", "b");

/* recursion */
function factorial(n) {
   if (n == 1) {
      return (1);
   } else {
      return (n * factorial(n-1));
   }
}
var i = factorial(5);

/************************************************************************
 *                                                                      *
 * Array Object:                                                        *
 *                                                                      *
 *    Properties:                                                       *
 *         length          prototype                                    *
 *                                                                      *
 *    Methods:                                                          *
 *         join            reverse         sort                         *
 *                                                                      *
 ************************************************************************/
function objArray() {
   var myArray = new Array(2);
   myArray[0] = 3;               // true arrays are indexed from 0.
   myArray[1] = 2;
   myArray[2] = 1;               // array automatically extended in size.

   /* array properties */
   var i = myArray.length;
   Array.prototype.myProto = "hello"

   /* array methods */
   var s = myArray.join(":");    // join all elements into 1 string with seperator
   myArray.sort();               // sort array
   myArray.reverse();            // reverse array order

   /* auto assign values to first 3 array elements */
   myArray = new Array("a", "b", "c");

   /* allocate object and assign properties */
   myArray = new Array(0);
   myArray["a"] = 0;
   myArray["b"] = 1;

   /* two dimensional arrays */
   var myArray1 = new Array(2);
   var myArray2 = new Array(3);
   var myArray = new Array(myArray1, myArray2);
   for (var i = 0; i < 2; i++) {
      for (var j = 0; j < 3; j++) {
         myArray[i][j] = 0;
      }
   }

   var urArray = [1,2,3];        // array literal
}
objArray();

/************************************************************************
 *                                                                      *
 * Simulated Arrays:                                                    *
 *                                                                      *
 ************************************************************************/
function makeArray(n) {
   this.length = n;
   for (var i = 1; i <= n; i++) {
      this[i] = null;
   }
   return (this);
}

function SimulatedArrays() {
   var myArray = new makeArray(2);
   myArray[1] = 0;               // index starts at for simulated arrays.  length is at 0.
   myArray[2] = 0;
   myArray[3] = 0;               // array automatically extended in size
}
SimulatedArrays();

/************************************************************************
 *                                                                      *
 * Boolean Object:                                                      *
 *                                                                      *
 *    Properties:                                                       *
 *         prototype                                                    *
 *                                                                      *
 *    Methods:                                                          *
 *         toString                                                     *
 *                                                                      *
 ************************************************************************/
function objBoolean() {
   var b = true;

   /* Boolean properties */
   Boolean.prototype.myProto = "hello"

   /* Boolean methods */
   var s = b.toString();
}
objBoolean();

/************************************************************************
 *                                                                      *
 * Number Object:                                                       *
 *                                                                      *
 *    Properties:                                                       *
 *         MAX_VALUE       NaN             NEGATIVE_INFINITY            *
 *         MIN_VALUE       prototype       POSITIVE_INFINITY            *
 *                                                                      *
 *    Methods:                                                          *
 *         toString                                                     *
 *                                                                      *
 ************************************************************************/
function objNumber() {
   var x;

   x = 07;                       // octal notation
   x = 0xf;                      // hex notation

   /* Number properties */
   x = Number.MAX_VALUE;
   x = Number.MIN_VALUE;
   x = Number.NaN;
   x = Number.NEGATIVE_INFINITY;
   x = Number.POSITIVE_INFINITY;
   Number.prototype.myProto = "hello"

   /* Number methods */
   var s = x.toString();
}
objNumber();

/************************************************************************
 *                                                                      *
 * Math Object:                                                         *
 *                                                                      *
 *    Properties:                                                       *
 *         E               LOG2E           PI              SQRT1_2      *
 *         LN2             LOG10E          prototype       SQRT2        *
 *         LN10                                                         *
 *                                                                      *
 *    Methods:                                                          *
 *         abs             ceil            max             round        *
 *         acos            cos             min             sin          *
 *         asin            exp             pow             sqrt         *
 *         atan            floor           random          tan          *
 *         atan2           log                                          *
 *                                                                      *
 ************************************************************************/
function objMath() {
   var x;
   var y = 0.5;

   /* Math properties */
   x = Math.E;                   // e         ~= 2.718
   x = Math.LN2;                 // ln(2)     ~= 0.693
   x = Math.LN10;                // ln(10)    ~= 2.302
   x = Math.LOG2E;               // log2(e)   ~= 1.442
   x = Math.LOG10E;              // l0g10(e)  ~= 0.434
   x = Math.PI;                  // pi        ~= 3.14
   x = Math.SQRT1_2;             // sqrt(1/2) ~= 0.707
   x = Math.SQRT2;               // sqrt(2)   ~= 1.414
   // Math.prototype.myProto = "hello"    // not available on IE

   /* Math methods */
   x = Math.abs(-1);             // absolute value: x = 1;
   x = Math.ceil(2.2);           // returns integer equal or above a number: x = 3;
   x = Math.exp(y);              // e^^y
   x = Math.floor(2.8);          // returns integer equal or below a number: x = 2;
   x = Math.log(y);              // natural log: x = ln(y);
   x = Math.max(1,2);            // max of two numbers: x = 2;
   x = Math.min(1,2);            // min of two numbers: x = 1;
   x = Math.pow(x, y);           // x^^y
   x = Math.random();            // random number between 0 and 1
   x = Math.round(2.5);          // integer round: x = 3;
   x = Math.sqrt(y);             // square root

   x = Math.acos(y);             // arccosine
   x = Math.asin(y);             // arcsine
   x = Math.atan(y);             // arctangent
   x = Math.atan2(y);
   x = Math.cos(y);              // cosine
   x = Math.sin(y);              // sine
   x = Math.tan(y);              // tangent
}
objMath();

/************************************************************************
 *                                                                      *
 * String Object:                                                       *
 *                                                                      *
 *    Properties:                                                       *
 *         length          prototype                                    *
 *                                                                      *
 *    Methods:                                                          *
 *         anchor          fontcolor       match           sub          *
 *         big             fontsize        replace         substring    *
 *         blink           indexOf         small           sup          *
 *         bold            italics         split           toLowerCase  *
 *         charAt          lastIndexOf     strike          toUpperCase  *
 *         fixed           link                            valueOf      *
 *                                                                      *
 ************************************************************************/
function objString() {
   var i;
   var a;
   var s = "chris";
   var myArray = new Array(0);

   /* String properties */
   var i = s.length;             // string length function: i = 5;
   String.prototype.myProto = "hello"

   /* String methods */
   a = s.charAt(0);              // character at index position in string (startpos=0)
   i = s.indexOf("i", 2);        // search for character in string - (startpos=1)
   s.lastIndexOf("i",2);         // search backwards (number of characters from end)
   i = s.match("hr");            // test if regular expression is in string
   s.replace("hr","r");          // replace pattern in string
   myArray = s.split(";");       // split string into an array (back out array join)
   a = s.substring(0,2);         // return substring
   s.toLowerCase(s);             // change string to lowercase
   s.toUpperCase(s);             // change string to uppercase
   i = s.valueOf();              // convert to numeric

   s.big();                      // big font
   s.blink();                    // blinking font
   s.bold();                     // bold font
   s.fixed();                    // fixed-pitch font
   s.fontcolor("blue");          // font color
   s.fontsize("10");             // font size
   s.italics();                  // italic font
   s.small();                    // small font
   s.strike();                   // strikethrough font
   s.sub();                      // subscript font
   s.sup();                      // superscript font

   s.anchor("myAnchor2");        // turn string into html anchor tag: ("anchorname")
   s.link("myLink");             // turn string into html href link tag

   /* operator manipulation */
   s = "a" + "b";                // concat operation: s = "ab";
   s = "19" + 60;                // auto convert to string: s = "1960";

   /* special characters */
   s = "\\"                      // backslash
   s = "\'"                      // single quote
   s = "\""                      // double quote
   s = "\t"                      // tab
   s = "\r"                      // carriage return
   s = "\b"                      // backspace
   s = "\f"                      // form feed
   s = "\n"                      // new line  (may not work in win32?  Use \r\n)
}
objString();

/************************************************************************
 *                                                                      *
 * Date Object:                                                         *
 *                                                                      *
 *    Properties:                                                       *
 *         prototype                                                    *
 *                                                                      *
 *    Methods:                                                          *
 *         getDate       getSeconds        setDate       setTime        *
 *         getDay        getTime           setHours      setYear        *
 *         getHours      getTimezoneOffset setMinutes    toGMTString    *
 *         getMinutes    getYear           setMonth      toLocaleString *
 *         getMonth      parse             setSeconds    UTC            *
 *                                                                      *
 ************************************************************************/
function objDate() {
   var i;
   var s;
   var d = new Date();

   /* Date properties */
   Date.prototype.myProto = "hello"

   /* Date methods */
   i = d.getDate();              // day of the month
   i = d.getDay();               // day of the week
   i = d.getHours();             // hour of the day
   i = d.getMinutes();           // minute  of the hour
   i = d.getMonth();             // months of the year (startpos=0)
   i = d.getSeconds();           // seconds of the minute
   i = d.getTime();              // complete time (msecs since 1970)
   i = d.getTimezoneOffset();    // time zone offset (hours from GMT)
   i = d.getYear();              // year (2 digit)

   d.setDate(31);                // set day of the month
   d.setHours(23);               // set hour of day
   d.setMinutes(59);             // set minutes of the hour
   d.setMonth(11);               // set month of the year
   d.setSeconds(59);             // set seconds of the minute
   d.setTime(10*180*12*59*59);   // set complete time (msecs since 1970)
   d.setYear(99);                // set year
   s = d.toGMTString();          // convert msec time to GMT time
   s = d.toLocaleString();       // convert msec time to locale time
   d = d.toString();             // convert to string same as toLocaleString

   d = new Date(Date.UTC(96,11,1,0,0,0));  // set to specific date: yy,mm,dd,hh,nn,ss
}
objDate();

/************************************************************************
 *                                                                      *
 * RegExp Object:                                                       *
 *                                                                      *
 *    Properties:                                                       *
 *         $0,$1,...$9                                                  *
 *                                                                      *
 *    Methods:                                                          *
 *         compile         exec                                         *
 *                                                                      *
 *    Expressions:                                                      *
 *           .  match any single char                                   *
 *         i|j  match i or j                                            *
 *       [ijk]  match any of the enclosed chars                         *
 *      [^ijk]  match any of chars not enclosed                         *
 *           ^  match to beginning of line                              *
 *           $  match to end of line                                    *
 *           *  match preceeding char 0 or more times                   *
 *           +  match preceeding char 1 or more times                   *
 *           ?  match preceeding char 0 or 1 times                      *
 *         {i}  match preceeding char exactly i times                   *
 *        {i,}  match preceeding char i or more times                   *
 *       {i,j}  match preceeding char i to j times                      *
 *         (i)  match and remember char                                 *
 *        /\#/  back reference                                          *
 *          \  next char is literal                                     *
 *         \f  form feed                                                *
 *         \n  line feed                                                *
 *         \r  carriage return                                          *
 *         \t  tab                                                      *
 *         \v  vertical tab                                             *
 *        /i/  ascii value: e.g. /0xA/                                  *
 *         \b  match word boundary                                      *
 *         \B  match non-word boundary                                  *
 *         \d  match digit                                              *
 *         \D  match non-digit                                          *
 *         \s  match white space                                        *
 *         \S  match non-white space                                    *
 *         \w  match any word char [A-Za-z0-9_]                         *
 *         \W  match any non-word char                                  *
 *                                                                      *
 ************************************************************************/
function objRegExp() {
   // p = new RegExp("*.htm","*.js");

   /* RegExp properties */

   /* RegExp methods */
}
objRegExp();

/************************************************************************
 *                                                                      *
 * Navigator Object:                                                    *
 *                                                                      *
 *    Properties:                                                       *
 *         appCodeName     appVersion      *platform       userAgent    *
 *         appName         *language                                    *
 *                                                                      *
 *    Objects:                                                          *
 *         mimetype_xxx    plugin_xxx                                   *
 *                                                                      *
 *    Collections:                                                      *
 *         mimeTypes[i]    plugins[i]                                   *
 *                                                                      *
 *    Methods:                                                          *
 *         javaEnabled     taintEnabled                                 *
 *                                                               (*NC4) *
 ************************************************************************/
function objNavigator() {
   var s;

   document.write("<br><hr><br><u>Navigator Object</u><br>");
   ro(navigator, "navigator");

   /* properties */
   s = navigator.appCodeName;    // browser code name
   s = navigator.appName;        // browser name
   s = navigator.appVersion;     // browser version
   s = navigator.userAgent;      // header text sent from client to server
   if (nc >= 4) {
      s = navigator.language;    // browser language
      s = navigator.platform;    // browser os
   }
}
objNavigator();

/************************************************************************
 *                                                                      *
 * Window Object:                                                       *
 *                                                                      *
 *    Properties:                                                       *
 *         closed          location        secure          top          *
 *         defaultStatus   name            self            window       *
 *         frameRate       opener          status                       *
 *         length          parent          offscreenBuffering           *
 *                                                                      *
 *    Collections:                                                      *
 *         frames[i]                                                    *
 *                                                                      *
 *    Objects:                                                          *
 *         crypto          history         navigator       *statusbar   *
 *         document        *locationbar    *personalbar    *toolbar     *
 *         frame_xxx       *menubar        *scrollbars                  *
 *                                                                      *
 *    Open Features:                                                    *
 *         *alwaysLowered  *hotkeys        scrollbars      *z-lock      *
 *         *alwaysRaised   location        status                       *
 *         *dependent      menubar         titlebar                     *
 *         directories     resizeable      toolbar                      *
 *                                                                      *
 *    Open Positioning:                                                 *
 *         height          *innerHeight    *outerHeight    {screenX}    *
 *         width           *innerWidth     *outerWidth     {screenY}    *
 *         *{pageXOffset}  *{pageYOffset}  *{type=fullWindow}           *
 *                                                                      *
 *    Methods:                                                          *
 *         alert           confirm         *moveTo         *routeEvent  *
 *         *back           find            open            scroll       *
 *         blur            focus           print           *scrollBy    *
 *         *captureEvents  forward         prompt          *scrollTo    *
 *         *clearInterval  *handleEvent    *releaseEvents  *setInterval *
 *         clearTimeout    home            *resizeBy       setTimeout   *
 *         close           *moveBy         *resizeTo       stop         *
 *                                                               (*NC4) *
 ************************************************************************/
function objWindow() {
   var i;
   var b;
   var s;

   document.write("<hr><br><u>Window Object</u><br>");
   ro(window, "window");

   /* properties */
   b = closed;                   // test if window closed
   defaultStatus = "status";     // default status-bar message
   i = length;                   // number of frames in the window
   // location = "hello.htm";    // full url of document displayed by window
   s = name;                     // name assigned to window when opened
   s = opener;                   // window in which window.open loaded current window
   s = parent;                   // synonym for window containing current frame
   s = self.name;                // synonym for current window or frame
   s = status;                   // status bar message
   s = top.name;                 // synonym for topmost window containing current frame
   if (nc >= 4) {
      i = innerHeight;           // height/width of the browser window
      i = innerWidth;
      i = outerHeight;
      i = outerWidth;
   }

   /* methods */
   /* user interface */
   alert("Alert Me");                              // alert dialog box
   var b = confirm("Confirm Me");                  // ok/cancel dialog box
   var s = prompt("Prompt Me", "Default Value");   // text prompt dialog box
   status = "Status Bar Message";                  // display status bar message

   /* window manipulation */
   blur();
   focus();
   // scroll(500, 1);

   /* child windows */
   var NewWin = open("hello.html", "NewWin", "scrollbars=no,toolbar=no,width=350,height=230");
   NewWin.close();               // open and close browser window

   /* timer events */
   var timerID = setTimeout("alert(\"Time Me\")",1000)  // set single timer event
   clearTimeout(timerID);                               // clear timer event
   if (nc >= 4) {
      timerID = setInterval("alert(\"Time Me\")",5000)  // set continuing timer event
      clearInterval(timerID);                           // clear timer event
   }

   if (nc >= 4) {
      /* toolbar buttons */
      // back();                 // move back
      // find();                 // find dialog box
      // forward();              // move forward
      // home();                 // load home page
      // print();                // print page
      // stop();                 // stop load

      /* window level event handling */
      /* captureEvents(); */
      /* handleEvent();   */
      /* releaseEvents(); */
      /* routeEvent();    */

      /* window positioning */
      /* moveBy();   */
      /* moveTo();   */
      /* resizeBy(); */
      /* resizeTo(); */
      /* scrollBy(); */
      /* scrollTo(); */
   }
}
objWindow();

/************************************************************************
 *                                                                      *
 * History Object:                                                      *
 *                                                                      *
 *    Properties:                                                       *
 *         current         length          next            previous     *
 *                                                                      *
 *    Methods:                                                          *
 *         back            forward         go                           *
 *                                                                      *
 ************************************************************************/
function objHistory() {
   var s;

   document.write("<hr><br><u>History Object</u><br>");
   ro(history, "history");

   /* history properties */
   s = history.current;          // current page url
   s = history.length;           // length of history
   s = history.next;             // next url
   s = history.previous;         // previous url

   /* history methods */
   // history.back();            // move back
   // history.forward();         // move forward
   // history.go(-1);            // move back or forward n pages
}
objHistory();

/************************************************************************
 *                                                                      *
 * Document Object:                                                     *
 *                                                                      *
 *    Properties:                                                       *
 *         alinkColor      domain          linkColor       title        *
 *         bgColor         fgColor         location        *URL         *
 *         cookie          lastModified    referrer        vlinkColor   *
 *                                                                      *
 *    Collections:                                                      *
 *         anchors[i]      forms[i]        layers[i]       *ids[i]      *
 *         applets[i]      images[i]       links[i]        *tags[i]     *
 *         embeds[i]                                                    *
 *                                                                      *
 *    Objects:                                                          *
 *         anchor_xxx      *classes        form_xxx        layer_xxx    *
 *         applet_xxx      embed_xxx       image_xxx       link_xxx     *
 *         area_xxx                                                     *
 *                                                                      *
 *    Methods:                                                          *
 *         *caputureEvents *handleEvent    *releaseEvents  write        *
 *         close           open            *routeEvent     writeln      *
 *         *getSelection                                                *
 *                                                               (*NC4) *
 ************************************************************************/
function objDocument() {
   var i;
   var s;

   document.write("<hr><br><u>Document Object</u><br>");
   ro(document, "document");

   /* properties */
   document.alinkColor = "red";  // active link color
   document.bgColor = "aqua";    // background color
   s = document.cookie;          // cookie info
   s = document.domain;          // server domain name
   document.fgColor = "blue";    // text color
   s = document.lastModified;    // last modified date
   document.linkColor = "green"; // document link color
   s = document.location.toString(); // URL of current document
   s = document.referrer;        // URL of document used to call current document
   s = document.title;           // document title
   document.vlinkColor = "pink"; // color of previously viewed links
   if ((vers >= 4) || (nc)) {
      s = document.URL;          // URL of current document
   }

   /* methods */
   /* i/o methods */
   // document.write("hello");   // write to document
   // document.writeln("world"); // writeln to document
   //s = document.getSelection();  // get currently selected text
   document.close();             // close the document stream
   document.open();              // open the document stream

   if (nc >= 4) {
      /* input methods */

      /* window level event handling */
      /* captureEvents(); */
      /* handleEvent();   */
      /* releaseEvents(); */
      /* routeEvent();    */
   }
}
objDocument();

/************************************************************************
 *                                                                      *
 * Form Object:                                                         *
 *                                                                      *
 *    Properties:                                                       *
 *         action          length          name            target       *
 *         encoding        method                                       *
 *                                                                      *
 *    Collections:                                                      *
 *         elements[i]                                                  *
 *                                                                      *
 *    Objects:                                                          *
 *         button_xxx      hidden_xxx      reset_xxx       text_xxx     *
 *         checkbox_xxx    password_xxx    select_xxx      textarea_xxx *
 *         fileupload_xxx  radio_xxx       submit_xxx                   *
 *                                                                      *
 *    Methods                                                           *
 *         reset           submit                                       *
 *                                                                      *
 ************************************************************************/
function objForm() {
   document.write("<hr><br><u>Form Object</u><br>");
   ro(document.myForm, "document.myForm");

   /* properties */
   s = document.myForm.action;   // destination URL for form submission
   s = document.myForm.encoding; // MIME encoding of the form
   i = document.myForm.length;   // number of form elements
   s = document.myForm.method;   // how data input is sent to server <method=>
   s = document.myForm.name;     // form name <name=>
   s = document.myForm.target;   // name of window that displays response after submit

   /* methods */
   // document.myForm.reset();   // reset form fields
   // document.myForm.submit();  // submit form

   /* forms array */
   for (i = 0; i < document.forms.length; i++) {
      s = document.forms[i].name;
   }
}
//objForm();

/************************************************************************
 *                                                                      *
 * Anchor Object:                                                       *
 *                                                                      *
 ************************************************************************/
function objAnchor() {
   var i;
   var s;

   document.write("<hr><br><u>Anchor Object</u><br>");

   /* no properties, methods or events */
   var s = document.myAnchor;    // null object

   /* anchors array */
   for (i = 0; i < document.anchors.length; i++) {
      s = document.anchors[i].name;
   }
}
objAnchor();

/************************************************************************
 *                                                                      *
 * Image Object:                                                        *
 *                                                                      *
 *    Properties:                                                       *
 *         x               x               x               x            *
 *                                                                      *
 *    Methods                                                           *
 *         x               x                                            *
 *                                                                      *
 ************************************************************************/
function objImage() {
   var i;
   var b;
   var s;

   document.write("<hr><br><u>Image Object</u><br>");
   ro(document.myImage, "document.myImage");

   /* properties */
   i = document.myImage.border;  // border attribute <border=>
   b = document.myImage.complete;// flag for image loaded
   i = document.myImage.height;  // image height <height=>
   i = document.myImage.hspace;  // horizontal spacing <hspace=>
   s = document.myImage.lowsrc;  // low res source file <lowsrc=>
   s = document.myImage.name;    // image name <name=>
   s = document.myImage.src;     // image source file <src=>
   i = document.myImage.vspace;  // vertical spacing <vspace=>
   i = document.myImage.width;   // image width <width=>
   i = document.myImage.x;       //
   i = document.myImage.y;       //

   /* images array */
   for (i = 0; i < document.images.length; i++) {
      s = document.images[i].name;
   }
}
objImage();
</script>
</form>
</body>
</html>

Chris Rathman / Chris.Rathman@tx.rr.com