JavaScript Text, Chapter 6 (Using Object-Oriented JavaScript Date Class), pgs 279 - 302
Reading:
- FormProcessor
- The form built in this chapter sends data from the subscription form to another page called
FormProcessor.html
- Explanation for the FormProcessor.html will be covered in assignment 2.
Practice:
Page 291, last line in step 4, should be method of the "dateObject". The book says "dataObject".
Page 298, Line 9: The text example does not close the "input" with a space
slash. Also, there is a logic error on the same page in the
calcGroupDiscount(). Neither groupSize = 5 or groupSize
= 10 is included in the text. Both result in no discount being applied. Additionally, if toLocaleString()
doesn't result in comma-delimited American-style numbers, don't worry about it.
// ********************************************************
// the code specified for getting days of month on pg 293
// is flawed. It does not take into account whether the year
// is leap year which changes the number of days in Feb
// daysInMonth function takes care of days in leap and nonleap years
// this snippet came from http://snippets.dzone.com/posts/show/2099
function daysInMonth(iMonth, iYear)
{
return 32 - new Date(iYear, iMonth, 32).getDate();
}
// now that's an amazing piece of function!
//**********************************************************
- Using the Date Class
- Create an assignment1 folder (no spaces in the name, no uppercase) in your public_html folder.
- CVSGroups.html Page
- Open your template.htm page in your editor.
- Save your template as CVSGroups1.htm in your assignment1 folder. (Notice the addition of the number 1 in the
name of the file and no l in the extension htm. The LTS editor
defaults the extension to htm. When I provide a file proved with the text, it will have the extension html.)
- I have entered much of the code in hopes that you will spend your time studying the code rather than keying it all in and
searching for typos. Please notify me if you find typos in my pages so that I can make corrections.
- Since you already saved your template, you have already completed steps 1 and 2 on page 288-289 except you
still need to change the title.
- I have provided the coding for:
page 289 step 3
page 289 step 4
- (remember to insert this before the close form tag in step 3)
- I also added the code from page 291, step 2 to this code. The link won't work yet.
page 289 step 5(remember to insert this before the submit button in step 4)
page 290 step 6(remember to insert this between
/* <![CDATA[ */
(put code here)
/* ]]> */
- Save in the assignment1 folder. Since I added the line of code from page 291, your page may not validate.
However, you should still try to bet out any validation errors that you can.
View your page by clicking the preview tab on the right.
JavaScript typos will show up in LTS when viewed this way.
Check to see that your page looks like Figure 6-6 on page 290.
- I have provided the coding for:
function displayCalendar()
pages 291-295 (remember to insert this above
/* ]]> */
- Check to see that your page validates and that it looks like Figures 6-7 on page 294 and Figure 6-8
on page 296.
- Accessing Number Class Properties
- CVSGroups2.htm Page
- If necessary, open CVSGroups1.htm from your assignment1 folder in your editor.
- Add the coding from pages 297 - 298 of your JavaScript text.
- Save the document as CVSGroups2.htm.
- Compare your page to figure 6-9 page 299.
- Using Math Class Merthods
- CVSGroups3.htm Page
- If necessary, open CVSGroups2.htm from your assignment1 folder in your editor.
- Add the coding from page 301 of your JavaScript text.
- Save the document as CVSGroups3.htm.
- Compare your page to figure 6-10 page 302.
- Declaring Basic Custom Objects
- CVSGroups4.htm Page
- If necessary, open CVSGroups3.htm from your assignment1 folder in your editor.
- Add the coding from page 304 of your JavaScript text.
- Save the document as CVSGroups4.htm.
- Compare your page to figure 6-12 page 305.
Project for this assignment
- Open your template.htm page.
- Save as tomorrow.htm in your assignment1 folder.
- Create a page that uses the current date and displays the current date and tomorrow's date.
- Save your document.
Update your index page:
- Add links on your index page to the pages in your assignment1 folder that are to be graded:
- CVSGroups4.htm
- tomorrow.htm
Uploading:
- Upload your revised index.htm page to the public_html folder.
- Upload your assignment1 folder with the files:
- CVSGroups4.htm
- tomorrow.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.