Create the following html file The top table contains text boxes. The bottom tab
ID: 3668299 • Letter: C
Question
Create the following html file
The top table contains text boxes.
The bottom table contains <div> elements for displaying output.
After the bottom table, there is a <div> element for displaying an order summary.
1.Create a JS function, SubmitOrder( ) that is saved in an external JS file.
a)Declare a variable for the sales tax rate: 0.08. Declare variables for all other inputs. Assign the appropriate text box value to each variable. b) Declare variables for each output.
c)Calculate the following: subtotal, sales tax amount, and total.
d)Display the output to the appropriate output div. Be sure to concatenate properly.
e)The order summary should display
“Your order of product will ship within 2 days for a total cost of $xx.xx”
2.Create a JS function, ClearForm() that is saved in the external JS file.
a)Clear the contents of the text boxes.
b)Clear the contents of the output divs.
example of what output should look like
table> Product Name Item Cost Quantity Accessories Cost: Shipping Cost k/table> Submit Order Clear Form Subtotal: Sales Tax: Total:Explanation / Answer
As you have asked to create a java script file. I have created one as per your requirements.
<script src="submitorder.js">
var salestaxrate = 0.08;
var ItemCost;
var Quantity;
var AccCost;
var ShipCost;
var subtotal;
var salestax;
var total;
ItemCost=document.getElementById("PName").value ;
Quantity=document.getElementById("Quantity").value ;
AccCost=document.getElementById("AccCost").value ;
ShipCost=document.getElementById("ShipCost").value ;
subtotal = ItemCost * Quantity + AccCost +ShipCost;
salestax = 0.08 * subtotal / 100;
total = subtotal + salestax;
document.write(total);
</script>
Here by I am giving model of html file you have.
In this I have used one text box with pname you can use the remaining as per your requirements.
<html>
<head>
<title>Order Form</title>
<script src="submitorder.js">
</script>
</head>
<table>
<tr>
<th> Description </th>
<th> Value </th>
</tr>
<tr>
<td>Product Name </td>
<td><input type="text" name="PName"></td>
<br>
<input type="button" value="Submit">
<input type="Reset" value="Clear Form">
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.