HW #11

  1. Write an HTML page that uses a prompt or an input text box to get an input number. The page should also contain a button. When the button is pressed, the page should display "Ouch!" that many times. (So if the user enters 5, the page should display "Ouch!" 5 times.)
  2. Write an HTML page that uses an input text box to ask the viewer for a phrase. The page should also contain a button. When the button is pressed, the page should display the input phrase 10 times. The HTML page should use a JavaScript function to write out the phrase. (So if the user enters "Hello World", the page should display "Hello World" 10 times.)
  3. Look at the example that demonstrates different types of loops . Experiment with different input values. Which type of loop takes the longest? How many times can you tolerate a quadratic loop? How many times can you tolerate a factorial loop?
  4. Extra Credit: Write an HTML page that will get a value from the user and then will generate a dynamic HTML page that will contain a list of items corresponding to the number given. For example, if the user enters 3, the page should display: Remember that the HTML tags for this are: <ul> <li> Item 1 </li> <li> Item 2 </li> <li> Item 3 </li> </ul> You can use document.write to produce these HTML tags. There will always be one <ul> tag and one </ul> tag. The <li> </li> tags have to be generated in a loop.