1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4.  
  5. <script language="JavaScript">
  6. <!--
  7.  
  8.  
  9. function Startup(){
  10. alert("HI")
  11. document.Hi.box.value=prompt("what your name")
  12. Usertwo = document.Hi.box.value;
  13.  
  14.  
  15. }
  16. function Change(){
  17.  
  18. Userone = document.Hi.box.value;
  19.  
  20. alert("You have been changed to " +Userone)
  21.  
  22. }
  23. function changeZ(){
  24. if (Userone==Usertwo) {"goodbye" + Userone}else{"goodbye" +Userone + "or" +Usertwo}
  25. }
  26.  
  27.  
  28.  
  29.  
  30. function compare(){
  31. nickone = document.Hi.box1.value;
  32. nicktwo = document.Hi.box2.value;
  33.  
  34. if (nickone == nicktwo) {
  35. alert("yes");
  36. }else{
  37. alert("no");
  38.  
  39.  
  40. }
  41.  
  42. }
  43.  
  44. </script>
  45.  
  46. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  47. </head>
  48.  
  49. <body onLoad="Startup()" onUnLoad="changeZ()">
  50. <body bgcolor="#999900" text="#003333" link="#006600" vlink="#FFFF00">
  51. <table width="16%" border="1" cellspacing="0" cellpadding="0">
  52. <tr>
  53. <td width="57%"><a href="week 4.htm">Home</a></td>
  54.  
  55. <td width="43%"><a href="Untitled-1.htmL">Events</a></td>
  56. <td width="57%"><a href="Untitled-2.html">Programming</a></td>
  57. </tr>
  58. </table>
  59. 6. Use the if statement below to say good bye to the user using the onUnLoad
  60. event and a function that check to see if the user has changed the name - if
  61. they have show an alert to say the new name as well as the original name- else
  62. just an alert with goodbye and the original name(to complete this one -you will
  63. need to have a variable to remeber what the first name entered is as well as
  64. one for the new name<br>
  65. 7. Add two text boxes to the form, when the second is changed - check to see
  66. if the entry is the same as the first text box - if so show an alert to that
  67. effect - if they are different change the second text box to be the same value
  68. as the first.<br>
  69. 8. Add yet another text box to the form and a button as well - now when a number
  70. is entered into the text box and the button is clicked (onClick event), if the
  71. number is not 15 make an prompt come up and ask for another guess - this needs
  72. to keep happening until the correct number is guessed (this will need to be
  73. a while statment)</font>
  74.  
  75. </p>
  76.  
  77. <form name="Hi" >
  78. Username
  79. <input type="text" name="box" onChange="Change()"><br>
  80. Compare <input type="text" name="box1" onChange="compare()"><br>
  81. Compare <input type="text" name="box2" onChange="compare()">
  82. </form>
  83.  
  84. </body>
  85. </html>
  86.  
  87.