HW #11
-
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.)
-
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?
-
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 > Item 2
< li > Item 3
< /ul >
You can use document.write to produce these HTML tags. There will always be
one < ul > tag and one < \ul > tag. The < li >
tags have to be generated in a loop.