Objectives: To obtain a solid understanding of client-side scripting and how it can be used to create dynamic content within a webpage.
Note that your files must be validated correctly in order to receive full credit. XHTML 1.0 Strict is expected (unless otherwise specified by the exercises).
A. Function: addNumbers
Parameter(s): Array of numbers
Each element in the array must be added and the summation (answer) must be returned.
B. Function: getCurrentDate
Retrieve the current date in the format similar to: Monday, May 10, 2010 and return it.
C. Function: arrayToString
Parameter(s): Array of words
All the elements of the array must be concatenated into a single string and returned.
D. Function: findMaxNumber
Parameter(s): None (Hint: Make use of the arguments array – page 167 in course book)
From the arguments array, find the number element that is the largest and return it.
E. Function: getDigits
Parameter(s): A String
Scan the string and find all the digits (0-9), concatenate them into a string in the order that they are found and return the string of numbers.
F. Function: reverseString
Parameter(s): A String
Reverse the entire string (character by character) and return the resulting string.
Given the following Regular Expressions, describe in detail the pattern accepted by each. Pay attention to all the characters being used. Your answers need not appear within an XHTML page.
Given the following descriptions, prepare a possible regular expression that expresses each of them.
Your answers need not appear within an XHTML page.
A. Matching a Name - First name must begin with a capital letter and be at least 2 characters long followed by either a ( , ) or a whitespace. The Last Name should begin with a capital letter and be at least 2 characters long but no greater than 20 characters long.
B. Matching an Email – First section should match word characters of any length except zero and must be followed by a @ symbol. The last section should match word characters of any length except zero and must not include an underscore ( _ ). A single period ( . ) must follow along with the word com at the end. No spacing is allowed within the pattern. The pattern need not match exactly (pattern can be a substring of a larger string).
Given the following XHTML page:
• What is your full name?
• How old are you?
The function should then build a string in the form of:
Hi, my name is FULL-NAME and I’m XX years old.
The string must then be inserted into the container div with id: content.
Note that your XHTML page must validate as 1.0 Strict – as such, make any needed additions to the XHTML code above.
Copy and paste the following XHTML code into a new document:
Note that your XHTML page must validate as 1.0 Strict – as such, make any needed additions or changes to the XHTML code above.
Copy and paste the following XHTML code into a new document:Exercise 6
Search a Course
Data Structures & Algorithms
Software Engineering I
The above XHTML code validates as 1.0 Strict and must not be modified in anyway.
Exercise 6: Project
The last exercise of each assignment will be continuous from assignment to assignment and will have the goal of building an e-store website by the end of the course.
Date & Time
Items on Sell
In the inside content area (see assignment 1) of your sites home page, you should create a small list of items that your store will be selling (your website can be a seller of whatever products you’d like). Each item should have a small thumbnail picture, an associated price, short description and a form button labeled “Add to Cart”. The button need not do anything when clicked at the moment.
Registration / Sign-up
In the side menu area (see assignment 1) add a link labeled “Register”. When clicked, the link should direct the user to a new page: register.html. This new page should include all the elements of your home page. In the inside content area, create a form with the following fields:
Text Fields: First name, Last name, Email Address, Phone Number
Password Fields: Password, Confirm Password