I-4 Web Work Assignment:

The assignment was to explore sample DHTML pages on the Web, either at Microsoft or Netscape Web sites,
or by searching the term DHTML sample pages in a search engine. Then choose one Web page, print it out
from the Web browser, and list the elements and, if applicable, describe briefly how they respond to a users
actions.

Problem: Do they realize how long JavaScript Code is?

Lets say not and do this. Below is a section of Javascript code that performs a function. I got the code from WebMonkey.
This function moves a positioned object from its current location to a new one. Optionally,
another JavaScript function can be fired upon completion of move (including another move).

This script would be copied and pasted into an existing DHTML document.

script language="JavaScript"
!--
function WM_moveTo(daObject, endLeft, endTop, numSteps, delay, endFunction) {

/*

WM_moveTo()

Moves an object from its current location to a new location and optionally fires a
function when it's done.

Source: Webmonkey Code Library

Author: Nadav Savio
Author Email: nadav@wired.com

Usage: WM_moveTo('objectName', endingLeft, endingTop, numberOfSteps, delayBetweenSteps,
'functionToFire()');

*/

  // Declare variables.
  var leftInc, topInc, daObj = new Object;
  // The first time through, create document.WM.WM_moveTo
  if (typeof document.WM == 'undefined'){
    document.WM = new Object;
    document.WM.WM_moveTo = new Object;
  } else if (typeof document.WM.WM_moveTo == 'undefined') {
    document.WM.WM_moveTo = new Object;
  }
  // Store endFunction to execute when the move is finished.
  if(endFunction) document.WM.WM_moveTo.endFunction = endFunction;
  // Get a good object reference (call it daObj) from WM_checkIn().
  // But if we've already done so, don't check it in again.
    if (daObject == "sameObj") {
      daObj = document.WM.WM_moveTo.daObj;
    } else {
      daObj = WM_checkIn(daObject);
      document.WM.WM_moveTo.daObj = daObj;
    }
  // If this is the last step, go to the end point and run endFunction.
  if (numSteps == 1) {
    daObj.left = endLeft;
    daObj.top = endTop;
    // If an endFunction was set, execute it and then delete it.
    if(document.WM.WM_moveTo.endFunction) {
      daFunction = document.WM.WM_moveTo.endFunction;
      document.WM.WM_moveTo.endFunction = '';
      eval(daFunction);
    }
  } else {
    // Otherwise, figure out how far to move.
    leftInc = (endLeft - parseInt(daObj.left)) / numSteps;
    topInc = (endTop - parseInt(daObj.top)) / numSteps;
    // Then move, decrement numSteps, and do it all again.
    daObj.left = parseInt(daObj.left) + leftInc;
    daObj.top = parseInt(daObj.top) + topInc;
    numSteps--;
    setTimeout ('WM_moveTo(\'sameObj\', ' + endLeft + ', ' + endTop + ', ' + numSteps + ',
    ' + delay + ')', delay);
  }
}





// -->

/script>