Appendix A: Answers to Exercises
672
You also need to add the class that describes how to clear content that comes after floated elements:
.
clear {clear:both;margin:20px;}
Finally, in order to make the next button sit to the right of the form, you need to...
More
Appendix A: Answers to Exercises
672
You also need to add the class that describes how to clear content that comes after floated elements:
.
clear {clear:both;margin:20px;}
Finally, in order to make the next button sit to the right of the form, you need to float that element to the
right of the fieldset:
.
next {float:right;}
Chapter 11
Exercise 1
Create a script to write out the multiplication table for the number 5 from 1 to 20 using a while loop.
Answer
The exercise is based around a counter (to work out where you are in your tables); each time the code is
run, the counter increments by 1.
So, you need to make sure the counter can go up to 20, rather than 10.
This goes in the condition of the while loop:
while (i < 21) {
Then you need to change the multiplier, which is both written out and used in the calculation:
document.
write(i + “ x 5 = “ + (i * 5) + “<br />” );
The final code should look like this:
<script type=”text/JavaScript”>
i = 1
while (i < 21) {
document.
write(i + “
Less