Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Index.Html: Midterm - Part B Delivery Please fix the indicated problems and then resubmit your form. Billing Address First name: Last name: Street Address: Gender:

image text in transcribed

Index.Html:

Midterm - Part B

Delivery

Please fix the indicated problems and then resubmit your form.

Billing Address

Shipping Address

script.js:

/*

Filename: script.js

*/

"use strict"

/* removing default values for gender and year select lists */

function removeSelectDefaults()

{

// ADD YOUR CODE IN HERE

}

/* Copying values from billing to shipping fields */

function copyBillingAddress()

{

// ADD YOUR CODE IN HERE

}

/* Validates addresses fieldsets */

function validateAddresses(fieldsetId)

{

// ADD YOUR CODE IN HERE

}

/* Validating form */

function validateForm()

{

validateAddresses("billingAddress");

validateAddresses("shippingAddress");

if(document.getElementsByTagName("form")[0].checkValidity())

{

document.getElementById("errorMessage").style.display = "none";

} else{

document.getElementById("errorMessage").style.display = "block";

}

}

/* Resets the page */

function resetPage()

{

location.reload();

}

/* Adds event listeners */

function createEventListeners()

{

document.getElementById("submitBtn").addEventListener("click", validateForm);

document.getElementById("sameAddr").addEventListener("click", copyBillingAddress);

document.getElementById("resetBtn").addEventListener("click", resetPage);

}

/* Runs initial form configuration functions */

function setUpPage()

{

removeSelectDefaults();

createEventListeners();

}

/* Runs setup function when page finishes loading */

window.addEventListener("load", setUpPage)

The question are:

Requirements:

1. Add to the JavaScript file a function to copy data from one field to another based on the checkbox Same as Billing Address, that indicates the respective fields should have the same value in the Shipping Address as in the Billing Address.

(6 Copyright Audrey Eernier Laroce. Modifed by fulio Vinieius for COMP125 Yidterm

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PC Magazine Guide To Client Server Databases

Authors: Joe Salemi

1st Edition

156276070X, 978-1562760700

More Books

Students also viewed these Databases questions

Question

What are the stages of project management? Write it in items.

Answered: 1 week ago