Create a function named delitm() with a single parameter

Assignment Help Programming Languages
Reference no: EM13935656

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 "<! -- Insert code here. -- >" 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

Reference no: EM13935656

Questions Cloud

Beginning work in process and costs added in november : Reconcile the sum of the two costs in part b to the sum of beginning Work in Process and costs added in November
List the characteristics of the phylum chordata : Although amphibians were the first animals to move onto dry land, they were still dependent on water for reproduction and lor respiration. What evolutionary adaptations allowed reptiles to become the first "true" land vertebrates?
Common features of internet search engines : If you had this citation for an article. Paul, D. L. (1999). Assessing technological barriers to telemedicine: Technology-management implications. IEEE Transactions on Engineering Management, 46(3) 279-289. What would you search to see if the libra..
Describe the business operation for the forecast : Describe the business operation you are considering for the forecast and scheduling of your expansion. What type of forecasting method would be appropriate for the company and the product or service selected? Why
Create a function named delitm() with a single parameter : 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 ..
Describe the appearance and function of plasmids : Compare methods of categorizing organisms. Are any of them better than the others or are they just different ways at looking at the same thing?
Strategic human resources management plan : I need to do a 12 month Strategic Human Resources Management plan. -I need to do an executive Summary which is 500 words . -I need to do an introduction which is around 1000 words long with 6-8 references.
Discuss the germ theory of disease : Describe the human diseases which are produced by the pathogenic microorganism selected. Does it exist in a non-pathogenic state as well? Under what health condition can the disease be produced?
Reimbursement and claim submission : Define ICD, HCPCS, and CPT and their effect on reimbursement and claim submission

Reviews

Write a Review

Programming Languages Questions & Answers

  Write pseudocode

Write pseudocode that represents the abstract functions of the enqueue and dequeue operations. Define and explain any supplementary information needed by your pseudocode.

  Program to accept inputs from user beginning temperature

Physicists tell us that lowest possible temperature is absolute zero. Absolute zero is -459.69 degrees Fahrenheit. Accept inputs from user: a beginning temperature, ending temperature, and increment value (all Fahrenheit).

  Create program to calculate and display number of miles

Create a program to calculate and displays the number of miles per hour over the speed limit that a speeding driver was doing. The program should ask for the speed limit and the drivers speed.

  Reservations system to be horizontal or vertical application

Top Sail Realty Situation: Top Sail Realty is one of the largest time-sharing and rental brokers for vacation cottages. Do you consider the reservations system to be a horizontal or a vertical application? Give reasons for your answer.

  Users selection and return to menu

Create a menu that will allow the user to list all wines by name in alphabetic order and count all wines in each type and list all 5 types with their count

  Create the application class using appropriate application

Test the class by placing the hard coded data into the driver class, which then instantiates your class and calls its instance method. Pass the hard coded data into the constructor and/or method.

  Explain the principle of programming to an interface

In your own words, explain the principle of programming to an interface. This explanation is meant to help develop your peers' understanding and should be written in as simple terms as possible

  Wilkerson-irwin algorithm to minimize mean tardiness

Write a program to implement the Wilkerson-Irwin algorithm to minimize mean tardiness.

  Create a crosstab query

Create a crosstab query to show how many enrollments took place in various conventions from different companies. Also show the total number of enrollments in each convention.

  Brief explanations for the solutions in the ms word file

You have a server-side script that cannot handle any ampersands (&) in the form data. Write a function that converts all ampersands in a form field to " and " when the field loses focus (onblur).

  Hierarchy of processes

Write a program that creates a hierarchy of processes using the fork() system call.

  Create the logic for the application fast-food resturant

Create the logic for the application which permits a user to enter the ordered item continuosly until sentinel value is entered.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd