Question
* Create, test, and validate an XHTML document that has a form with the following controls:
a. A text box to collect the user’s name
b. Four checkboxes, one each for the following items:
i. Four 100-watt light bulbs for $2.39
ii. Eight 100-watt light bulbs for $4.29
iii. Four 100-watt, long-life light bulbs for $3.95
iv. Eight 100-watt, long-life light bulbs for $7.49
c. A collection of three radio buttons that are labeled as follows:
i. Visa
ii. Master Card
iii. Discover
Cascading Style Sheets
* Create and test an XHTML document that has at least a half page of text and that has a small box of text embedded on the left margin, with the main text flowing around the small box. The embedded text must appear in a smaller font and also must be set in italic.
* Create and test an XHTML document that describes nested ordered lists of cars. The outer list must have three entries: compact, midsize, and sports. Inside each of these three lists there must be two sub-lists of body styles. The compact- and midsize-car sub-lists are two door and four door; the sports-car sub-lists are coupe and convertible. Each body-style sub-list must have at least three entries, each of which is the make and model of a particular car that fits the category. The outer list must use uppercase Roman numerals, the middle lists must use uppercase letters, and the inner lists must use Arabic numerals. The background color for the compact-car list must be pink; for the midsize-car list, it must be blue; for the sports-car list, it must be red. All of the styles must be in a document style sheet.
* Create and test an XHTML document that describes an unordered list of at least five popular books. The bullet for each book must be a small image of the book’s cover. Find the images on the Web.
JavaScript
* Write, test, and debug (if necessary) JavaScript scripts for the problems that follow. When required to write a function, you must include a script to test the function with at least two different data sets. In all cases, for testing, you must write an XHTML file that references the JavaScript file.
Output: The first 20 Fibonacci numbers, which are defined as in the sequence 1, 1, 2, 3, 5 … where each number in the sequence after the second is the sum of the two previous numbers. You must use document.write to produce the output.
* Write, test, and debug (if necessary) JavaScript scripts for the problems that follow. When required to write a function, you must include a script to test the function with at least two different data sets. In all cases, for testing, you must write an XHTML file that references the JavaScript file.
Input: Three numbers, using prompt to get each.
Output: The largest of the three input numbers.
Hint: Use the predefined function Math.max.
* Modify the script to use prompt to input a number n that is the number of the Fibonacci number required as output.
* Write, test, and debug (if necessary) JavaScript scripts for the problems that follow. When required to write a function, you must include a script to test the function with at least two different data sets. In all cases, for testing, you must write an XHTML file that references the JavaScript file.
Input: A text string, using prompt.
Output: Either “Valid name” or “Invalid name”, depending on whether the input names fit the required format, which is Last name, first name, middle initial where neither of the names can have more than 15 characters.
* Write, test, and debug (if necessary) JavaScript scripts for the problems that follow. When required to write a function, you must include a script to test the function with at least two different data sets. In all cases, for testing, you must write an XHTML file that references the JavaScript file.
Function: first_vowel
Parameter: A string.
Returns: The position in the string of the leftmost vowel.
JavaScript and XHTML
* Develop, test, and validate an XHTML document that has checkboxes for apple (59 cents each), orange (49 cents each), and banana (39 cents each), along with a Submit button. Each of the checkboxes should have its own onclick event handler. These handlers must add the cost of their fruit to a total cost.
An event handler for the Submit button must produce an alert window with the message: Your total cost is $xxx, where xxx is the total cost of the chosen fruit, including 5 percent sales tax. This handler must return false (to avoid actual submission of the form data).
* Develop, test, and validate an XHTML document. In this case, use text boxes rather than checkboxes. These text boxes take a number, which is the purchased number of the particular fruit.
Dynamic Documents with JavaScript
* Write, test, validate, and debug (if necessary) the following documents for JavaScript:
The document must display an image and three buttons. The buttons should be labeled simply 1, 2, and 3. When pressed, each button should change the content of the image to that of a different image.
* Write, test, validate, and debug (if necessary) the following documents for JavaScript:
The document must contain the statement “Save time with TIMESAVER 2.2,” which continuously moves back and forth across the top of the display.
* Modify the document to make the statement change color between red and blue every fifth step of its movement (assuming that each move is 1 pixel long).
* Modify the mover example to input the starting and ending position of the element to be moved.
PHP
* Write, test, and debug (if necessary) PHP scripts for the specifications that follow. Write the XHTML code to create a form with the following capabilities:
a. A text widget to collect the user’s name
b. Four checkboxes, one each for the following items:
i. Four 100-watt light bulbs for $2.39
ii. Eight 100-watt light bulbs for $4.29
iii. Four 100-watt long-life light bulbs for $3.95
iv. Eight 100-watt long-life light bulbs for $7.49
c. A collection of three radio buttons that are labeled as follows:
i. Visa
ii. MasterCard
iii. Discover
Servlets
* Write a servlet that returns a randomly chosen greeting from a list of five different greetings. The greetings must be stored as constant strings in the program.
* Write the markup document to create a form with the following capabilities:
a. A text widget to collect the user’s name
b. Four checkboxes, one each for the following items:
v. Four 100-watt light bulbs for $2.39
vi. Eight 100-watt light bulbs for $4.29
vii. Four 100-watt long-life light bulbs for $3.95
viii. Eight 100-watt long-life light bulbs for $7.49
c. A collection of three radio buttons that are labeled as follows:
iv. Visa
v. MasterCard
vi. Discover
* Write a servlet that computes the total cost of the ordered light bulbs after adding 6.2 percent sales tax. The servlet must inform the buyer of exactly what was ordered, in a table.
Solution Preview
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
XHTML<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<form method="POST">
User name : <input type="text" name="" value="" />
<br />
<br />
<input type="checkbox" name="" value="ON" />Four 100-watt light bulbs for $2.39
<br />
<input type="checkbox" name="" value="ON" />Eight 100-watt light bulbs for $4.29
<br />
<input type="checkbox" name="" value="ON" />Four 100-watt, long-life light bulbs for $3.95
<br />
<input type="checkbox" name="" value="ON" />Eight 100-watt, long-life light bulbs for $7.49
<br />
<br />
<input type="radio" name="rbs" value="visa" />Visa
<input type="radio" name="rbs" value="mc" />Master Card
<input type="radio" name="rbs" value="dis" />Discover
<br />
<br />
<input type="submit" value="Submit" />
</form>
</body>
</html>...