Question: Option #1: Using User Input in JavaScript In this week's Critical Thinking Assignment, you'll enhance a form to create an account ID value based on
Option #1: Using User Input in JavaScript


In this week's Critical Thinking Assignment, you'll enhance a form to create an account ID value based on the user's first and last initials, and then you'll add all the account information to an array. 1. In your text editor, open the index.htm file from the HandsOnProject8-1 folder in the Chapter08 folder , add your name and today's date where indicated in the comment section, and then save the file. 2. Before the closing /body tag, add the following script element, save your changes, and then close index.htm: scriptsrc="script.js"> 3. Create a new file in your text editor, create a JavaScript comment section containing the text Handson Project 8-1, your name, today's date, and the filename script.js, and then save the file with the name script.js to the HandsOnProject8-1 folder. 4. Add a statement instructing processors to interpret the document contents in strict mode. Add another statement declaring a global variable named newAccountArray with an empty array as its value. 5. Declare a new function named createlD(). Declare the local variables listed in Table 8-8, with values referencing the elements with the id values shown. 6. Also declare a local variable named fields with a value that references all elements with the tag name input. Finally, declare the local variables acctid, firstlnit, and lastInit with no values. a. Within the createlD()function, create an if statement that checks if the values of the elements referenced by the fname, Iname, and zip variables are all non-null. (Hint: Check if each value is not equal to an empty string ("').) Add the following statements to run if the condition is true: 1 firstinit = fname.value.charAt (0).toUppercase (); 2 lastinit = Iname.valuecharAt (0).toUppercase (); 3 acctid = firstInit + lastInit + zip.value; 4 account.value = acctid; 5 newAccountArray =[]; 6 for (var i=0;i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
