Lab 10 - It 130

    Before you begin make sure you understand the code.
  1. Get the code for temperature2.html at the course homepage. Play around with it and make sure you understand how it works
  2. Modify temperature2.html by adding another button called wipeout. This button should be the last element on the page. The purpose of this button will be to clear the textboxes when clicked. You must write a function to clear the text boxes. The following piece of code shows how to clear the Fahrenheit box.
  3. document.frmTemp.txtFahr.value = "";
  4. Type in the following piece of javascript code.
  5. <html> <head> <title>First Example handling events it130 </title> <script type="text/javascript"> function displayNumber() { var luck; luck = Math.floor(Math.random() * 10) + 1; document.frmLucky.number.value = luck; } </script> <head> <body> <h3>Lucy Number</h3> <form name="frmLucky"> <input type="button" value="Click here for lucky number" onclick="displayNumber();" /> <p>Your lucky number is : <input type="text" name="number" size="5" value="" /> </form> </body> </html>
  6. Modify the code that it will produce 4 lucky numbers in the range 1 - 50.
  7. Work on previous labs.