Please only bet if you are really good at javascript and html. DO NOT BET IF YOU ARE NOT GOOD AT Java.sc
Overview
The intent of this assignment is to demonstrate your ability to use JavaScript in several of the most common uses found on the web. Specifically, you will demonstrate your proficiency with loops, conditionals, arrays, and functions in JavaScript, as well as demonstrate your ability to respond to events, select and modify elements via the DOM, and to validate form data.
Grading
The grade for this assignment will be broken down as follows:
- Functional Requirements (85/100)
- Non-functional requirements (15/100)
Non-Functional Requirements
- You must submit valid and semantically appropriate HTML5.
- You have been provided with the two HTML files (
BasicJavaScript.html
andDOMJS.html
) that includes the markup for the finished versions. Download and preview the files in a browser. - All pages in your site must contain a comment with your name, section, and date
Functional Requirements: Basic JavaScript Hands on Practice
Demonstrate your proficiency with loops, conditionals, arrays, and functions in JavaScript. The final product should look similar to that shown below.
- Complete the assignment as directed below and within the image.
- Test the page in the browser. Verify that the calculations work appropriately by changing the values in the
data.js
file.
- You have been Provided with the HTML file BasicJavaScript.html that includes the markup for the finished version. Preview the file in a browser.
- Examine the data file
data.js
. It contains 4 arrays that we are going to use to programmatically generate the data rows (and replace the hard-coded values supplied in the HTML file). - Open the JavaScript file
functions.js
and create a function calledcalculateTotal ()
that is passed a quantity and price and returns their product (i.e., multiply the two parameter values and return the result). - Within functions.js, create a function called
outputCartRow ()
that has the following signature: functionoutputCartRow(file, title, quantity, price total) {}
- Implement the body of this function. It should use
document.write ()
calls to display a row of the table using the passed data, Use thetoFixed ()
method of number variables to display two decimal places. - Replace the three cart table rows in the original markup with a JavaScript Loop that repeatedly calls
outputCartRow ()
function. Put this loop within theBasicJavaScript.js
file. Add the appropriate<script>
tag to reference thisBasicJavaScript.js
file within the<tbody>
element. - Calculate the subtotal, tax, shipping, and grand total using JavaScript calculations. Use
10%
as the tax amount. The shipping amount should be$40
unless the subtotal is above$1000
, in which case it will be$0
.
Test
- Test the page in the browser. Verify that the calculations work appropriately by changing the values in the
data.js
file.
Functional Requirements: DOM JavaScript Hands on Practice
- Complete the assignment as directed below.
- You have been provided with the html file
domjs,html
that represents the data entry form shown below. Examine this file in your browser. - You will notice that some of the form elements have the CSS class
hilightable
specified in theirclass
attribute. Add listeners to thefocus
andblur
events of all elements that have thishilightable
class. In your event handlers for these two events, simply toggle the classhighlight
(which is in the provided CSS file). This will change their styling of the current form element. Be sure to setup these listeners after the page has loaded. - You will notice that some of the form elements have the CSS class
required
specified in theirclass
attribute. We will not submit the form if these elements are empty. Add an event handler for the submit event of the form. In this handler, if any of the required form elements are empty, add the CSS classerror
to any of the empty elements. As well, cancel the submission of the form (hint: use thepreventDefault ()
method). - Add the Appropriate handler for these required controls that will remove the CSS class
error
that have changed content.
- Test the form in the browser. Verify the highlighting functionality works by tabbing from field to field. Try submitting the form with blank fields to verify the error formatting works. Verify the error formatting is removed if you add content and then resubmit.
Grading Criteria
Functional Requirements
- Java Script Loop /8
- Calls to Function /8
- Function: single cart row /8
- function: calculate /8
- Required fields (3) /9
Hilightable
fields (7) /14- handlers (2 – focus/blur) /6
- submission error (3) /15
- Submit handler /9
Non-Functional
- Comments /5
- Submission /10