Assignment #2

Write javascript to do the following:

  1.  Calculator:  Add, Subtract, Multiply, Divide two numbers
            Validation:  The two numbers must be valid integers
                                 On division, the first number cannot be 0

  2.  Color Changer  (changes background color)
             Allow user to type in color name.
             Allow user to click a button for a random color.   Display the value of the color Hex value.

           function to create a random hex color in the format of #FFFFFF:

   function randomHexColor (   )   {

      var array = new Array (   "f", "e", "d", "c", "b", "a", "9", "8", "7", "6", "5", "4", "3", "2", "1"   );  // array of possible hex values.
      var endHex = "#";  
      for (   var i = 0; i < 6; i++   )  
            endHex += array[Math.round (   Math.random (   ) * array.length   )];  
      return endHex;
} 

   3.  Select Box to favorite web sites

   4.  Guessing game -  on number between 1 and 100, stop the user if he / she exceeds 7 guesses.

   5.  Find some other JavaScript on the web.   http://www.javascriptkit.com/