Assignment Set 2


<SCRIPT>

var Msg = new Array();

Msg[0] = "Isn't JavaScript just great...                                    ";
Msg[1] = "This is one way to do this assignment...                 ";
Msg[2] = "As you can see, it is not that hard...                        ";
Msg[3] = "It takes a little bit of practice & a lot of patience...";

var speed = 50 ;     // decrease value to increase speed (must be positive)
var pause = 1000;  // increase value to increase pause

var Index = 0; // Msg counter
var i = 0;        // character counter within a Msg

function typeMsg() {
     status = Msg[Index].substring(0, i + 1);

     if (i < Msg[Index].length) {
          i++;
          setTimeout("typeMsg()", speed);
     }
     else {
          i = 0;
          if (Index == Msg.length - 1) Index = 0;
          else Index++;
          setTimeout("typeMsg()", pause);
     }
}

</SCRIPT>

<BODY onLoad="typeMsg()">

<FORM>

<SELECT onChange="location.href=options[selectedIndex].value">
     <OPTION VALUE="default.htm">Select a Page</OPTION>
     <OPTION VALUE="232v1.htm">Exercise 2 v1</OPTION>
     <OPTION VALUE="232v2.htm">Exercise 2 v1</OPTION>
     <OPTION VALUE="233.htm">Exercise 3</OPTION>
</SELECT>

</FORM>

Assignment Set 2 Zipped