JavaScript Text, Chapter 5, pgs 240 - 244 (Radio Buttons)
JavaScript Text, Chapter 3, pgs 130 - 145 (Making Decisions)
Reading:
- Forms and Selection
- The text continues to use form elements when explaining selection and selection when explaining form elements.
Start by reading the radio buttons pages 240 - 244.
- After you input the Subscription.html page (through page 244), switch to chapter 3 to start reading
about selecton.
- Continue reading Chapter 3 pages 130 - 145.
- The PilotQuiz1.html program uses radio buttons. Notice that the name of a group of radio buttons remains the
same, but the value differs. When a user chooses a radio button from a group, only one button can be chosen.
- Additionally, several functions are called, for example scoreQuestion1. When the function is called a value (argument)
is included in the call that takes a value to the function. That value coincides with the value assigned to the
value attribute.
Practice:
- Radio Buttons
- Create an assignment6 folder (no spaces in the name, no uppercase) in your public_html folder.
- Subscription page
- Open your subscription.htm page from your assignment5 folder in your editor.
- Save as subscription.htm in your assignment6 folder.
- The coding on pages 237 - 239 is not included now because it contains examples from chapter 4 that
we haven't covered.
- Add the coding from pages 241 and 242 of the text.
- Save the document.
- Compare your page to Figure 5-10 page 242 (you will not have the password field).
- Add the coding from pages 243 - 244 of the text. There is a typo on page 244 step 4. The second value
should be monthly.
- Save the document.
- if Statements
- PilotQuiz1 page
- Open your template.htm page in your editor.
- Save as pilotQuiz1.htm in your assignment6 folder.
- Add the coding from pages 132 - 135 of the text.
- Save the document.
- Compare your page to Figure 3-6 on page 135 of the text.
- if ... else Statements
- PilotQuiz2 page
- If necessary, open your pilotQuiz1.htm page in your editor.
- Save as pilotQuiz2.htm in your assignment6 folder.
- Add the coding from page 137 of the text.
- Save the document.
- Nested if and if ... else Statements
- PilotQuiz3 page
- If necessary, open your pilotQuiz2.htm page in your editor.
- Save as pilotQuiz3.htm in your assignment6 folder.
- Add the coding from page 139 - 142 of the text.
- Save the document.
- switch Statements
- PilotQuiz4 page
- If necessary, open your pilotQuiz3.htm page in your editor.
- Save as pilotQuiz4.htm in your assignment6 folder.
- Add the coding from page 144 - 145 of the text. On page 145, the answers are incorrect. The answers
on page 140 are correct.
- Save the document.
- return to Radio Buttons
- Subscription page
- If necessary, open your subscription.htm page in your editor.
- Add the coding from pages 243 - 244 of the text.
- Save the document.
Case Project:
- Complete Case Project 3-3 found on pages 169 - 170 of your text.
- Open your template.htm page.
- Save as gasMileage.htm in your assignment6 folder.
- Follow the steps described in the text but start with the template so that you will
have the validation icons on your page.
-
Hint:Use the onchange event handler with this problem.
onchange="calcMPG()"
- In your function, you could assign the values from without using the argument in the call.
For instance:
var startMiles = parseInt(document.mileageLog.startingMiles.value);

Update your index page:
- Add links on your index page to the pages in your assignment6 folder that are to be graded:
- subscription.htm
- pilotQuiz4.htm
- gasMileage.htm
Uploading:
- Upload your revised index.htm page to the public_html folder.
- Upload your assignment6 folder with the files:
- subscription.htm
- pilotQuiz4.htm
- gasMileage.htm
Testing uploaded pages
- Follow the checklist for grading shown on
the schedule page.
- Make any corrections for any page that does not validate or display correctly.