Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

SHOPPING CART PAGE FOR THE DANIEL JAMES COLLECTION

1. At the end of file dan.js, create a function named makeTable(). The function should write the opening table tag and the first row of a table to a Web page. The table should have a width of 500 pixels. The first row of the table should contain four table header cells, containing the text "Item Name", "Item Price", "Quantity", and "Cost". Be sure to close the table row.

2. Create a function name endTable() that writes a closing table tag.

3. Create a function named addCart() that accepts three parameters: "itm", "p", and "v".

a. Use an if statement to check if the parameter "v" is equal to zero. If so, then pass the value of the input field "bowl1" from the form "item1" to a variable named "q".

b. Use an if statement to check if the parameter "v" is equal to 1. If so, then pass the value of the input field "bowl2" from the form "item2" to a variable named "q".

c. Use an if statement to check if the parameter "v" is empty. If so, then create an alert box displaying the text "Please enter

a quantity greater than zero." The function should then return "false".

d. Create a variable named currDate with a value equal to the current date. Below it, create a variable named expdate with a value equal to a date six months from the current date.

e. Create a cookie with the name "danv" where v is the value of the variable "v". The value of the cookie should be the values held in the variables "itm", "p", and "q", separated by commas. The cookie's expiration date should equal the value of the variable expdate converted to GMT.

f. Generate an alert box displaying the text "Thank you for your purchase of the "+itm+"."

4. Create a function named seeItm().

a. Create a variable named addTot and set it equal to zero.

b. Create an array named "itm". Pass the value of the cookies dan0 and dan1 to the array.

c. Using an if statement, evaluate each element in the array "itm" to see if it is null. If both array elements are null, then write the text "Your cart is empty." and return "false". Otherwise, call the function makeTable() and loop through all of the items in the array "itm". For each item, use an if statement to confirm that the element is not null and not empty. If these conditions are both true, execute the following commands:

• Write an opening table row tag and an opening table data tag.

• Find the first instance of a comma in the first element of the array "itm". Pass the result to a variable named stopnow. Find the value of the item by searching the string from the very beginning to a point specified in the variable named "stopnow". Pass the results of this search to a variable named "start". Write the value of the variable "start" to the file followed by a closing table cell tag and an opening table cell tag.

• Search the array element for a comma. After finding its numeric location in the string, add 1 to this value and pass the entire results to a variable named px. Search the element for another comma from a starting point held in the variable px. Pass the results to a variable named px2. Pull out from this string all text starting from a point designated by the value held in the variable px and ending at a point designated by the value held in the variable px2. Parse out the number, including decimal values. Pass this result to a variable named tot_px. Fix the numeric value to two decimal places and pass the result to a variable named tot_px1. Write the value of the variable tot_px1 to the file, followed by a closing table cell tag and an opening table cell tag specifying center alignment.

• You will now extract the last value in the array element. Take the entire length of the array element and subtract 1 from it. This is the starting point to extract the substring that contains the quantity value. The end point is the entire length of the array element. Given the starting and ending points in the array element, search out the quantity value held in the array. Parse out the number and pass it to the variable quant. Write the value of the quant variable to the document followed by a closing table cell tag and an opening table cell tag specifying right alignment.

• Multiply the values in the variables quant and tot_px and pass the result to a variable named cost_raw. Fix the numeric display of the variable cost_raw to two decimal places. Pass the result of this to the variable "cost". Parse out the numeric value of "cost", including decimals, and pass this value to the variable cost_tot. Add the value of cost_tot to the existing value of addTot. Fix the value of addTot to two decimal places and pass the result to a variable named "total".

• Write a dollar sign followed by the value of the variable "cost" to the document, followed by a closing table cell tag and an opening table cell tag specifying right alignment. Next write the text link "Remove Item" with href set to # and an onclick() event handler that calls the function delItm() with the argument "+[i]+".

• Write a closing table cell tag followed by a closing table row tag. Write a new table row. The row's only cell should span four columns and should be right-aligned. The cell should contain the text "The total cost of your order is" followed by a dollar sign and the value of the "total" variable, formatted as bold. Close the else statement, then call the function endTable().

5. Create a function named delItm() with a single parameter, "itm".

a. The function should create a cookie named "danx" where x is the value of the "itm" parameter. Set the cookie to expire immediately.

b. Next, the function should reload the page in the browser.

6. In the file dan_cart.htm, replace the comment "" with a script calling the function seeItm().

7. Open dan.htm in the browser. Add an item to the cart, then click the View Cart button at the top of the page. View the contents of the shopping cart. Test the functionality for removing items from the cart by clicking the Remove Item link for the item placed in the cart.

Attachment:- zipped html gif css js files.zip

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M91606540
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Programming Language

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

Question 1 what is hadoop explaining hadoop 2 what is

Question: 1. What is Hadoop (Explaining Hadoop) ? 2. What is HDFS? 3. What is YARN (Yet Another Resource Negotiator)? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow t ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Overviewthis tasks provides you an opportunity to get

Overview This tasks provides you an opportunity to get feedback on your Learning Summary Report. The Learning Summary Report outlines how the work you have completed demonstrates that you have met all of the unit's learn ...

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to th ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Php amp session managment assignment -this assignment looks

PHP & SESSION MANAGMENT ASSIGNMENT - This assignment looks at using PHP for creating cookies and session management. Class Exercise - Web Project: Member Registration/Login This exercise will cover adding data connectivi ...

Task arrays and structsoverviewin this task you will

Task: Arrays and Structs Overview In this task you will continue to work on the knight database to help Camelot keep track of all of their knights. We can now add a kingdom struct to help work with and manage all of the ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As