Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 307 Weeks Ago, 1 Day Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 15 Jul 2017 My Price 11.00

Web Scripting class for JavaScript

I'm in a Web Scripting class for JavaScript and having a hell of a time with doing this question, I have tried to find similar code to break down and figure it out, but I can't seem to find any.

  1. In the JavaScript file, write the code for calculating and displaying the salestax and invoice total when the user clicks on the Calculate button.
  2. If you havenA????1t already done so, add data validation to this application. Thesubtotal entry should be a valid, positive number thatA????1s less than 10,000. Thetax rate should be a valid, positive number thatA????1s less than 12. The errormessages should be displayed in the span elements to the right of the textboxes, and the error messages should be: "Must be a positive number less than $10,000" and "Must be a positive number less than 12.
  3. Add JavaScript code that moves the cursor to the Subtotal field when the application starts and when the user clicks on the Calculate button.
  4. Add the JavaScript event handler for the click event of the Clear button. This should clear all text boxes, restore the starting messages, and move the cursor to the Subtotal field.
  5. Add JavaScript event handlers for the click events of the Subtotal and Tax Rate text boxes. Each handler should clear the data from the text box.

Here is the HTML:

<!DOCTYPE html>
<html>
<head>
   <meta charset="utf-8">
   <title>Sales Tax Calculator</title>
<link rel="stylesheet" href="/styles.css" />  
   <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>  
<script src="/sales_tax.js"></script>
</head>
<body>
<div id="content">
<h1>Sales Tax Calculator</h1>
<p>Enter Subtotal and Tax Rate and click "Calculate".</p>
<div id="taxCalc">
<label for="subtotal">Subtotal:</label>
<input type="text" id="subtotal" >
<span id="subtotal_message">Enter order subtotal</span><br />

<label for="tax_rate">Tax Rate:</label>
<input type="text" id="tax_rate" >
<span id="tax_rate_message">Enter sales tax rate (99.9)</span><br />

<label for="sales_tax">Sales Tax:</label>
<input type="text" id="sales_tax" disabled ><br />

<label for="total">Total:</label>
<input type="text" id="total" disabled ><br />

<label>&nbsp;</label>
<input type="button" id="calculate" value="Calculate" >
<input type="button" id="clear" value="Clear" ><br />
</div>
</div>
</body>
</html>

and here is the JavaScript I have:

var $ = function (id) {
return document.getElementById(id);
}
var calculate_click = function () {
   var subtotal = parseFloat( $("subtotal").value );
var taxRate = parseFloat( $("tax_rate").value );

   $ salesTax (subtotal * (taxRate / 100));
   $ total (subtotal + salesTax);
  
  
}
var clear_click = function (clear) {
   return document.getElementByID(clear);
   document.getElementByID("subtotal").value = ""; // Clear Subtotal Box
   document.getElementByID("tax_rate").value = ""; // Clear Tax Rate Box
   document.getElementByID("sales_tax").value = ""; // Clear Sales Tax Box
   document.getElementByID("total").value = ""; // Clear Total Box
   $("subtotal").focus();
}

window.onload = function () {
$("calculate").onclick = calculateClick;
$("clear").onclick = clear_click;      
$("subtotal").onclick = clearSubtotal;
   $("tax_rate").onclick = cleartax_rate;
   $("sales_tax").onclick = clearsales_tax;
$("subtotal").focus();
}

Answers

(5)
Status NEW Posted 15 Jul 2017 05:07 PM My Price 11.00

Hel-----------lo -----------Sir-----------/Ma-----------dam----------- Â----------- Th-----------ank----------- Yo-----------u f-----------or -----------usi-----------ng -----------our----------- we-----------bsi-----------te -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill-----------

Not Rated(0)