CheckBox and ID Attribute Jav

Assignment 1 for JavaScript 1!

The assignment is an individual assignment where you as a student must set up a form on a website and via JavaScript be able to perform a calculation with these values.
After the form, there should be a button that activates the JavaScript, which should be in a function. This function should perform a variety of actions depending on the values entered by the user, according to the following criteria below.
There must also be a paragraph with an ID attribute used for output from the calculation.

Your form should have the following fields:
● Two text fields where the user can enter the names of two different people. (Text)
● There must be a password field. (Password)
● There must be a number field where the user can enter a number. This number should be used in a loop in the JavaScript. (Number)
● There must be a CheckBox that indicates whether the user wants a repeat of his output or not. (Checkbox)

When the user presses the button, the following must be performed:
● First, the Script should check that at least one name has been entered in the name text fields. If none of the fields have a text, an error message will be printed to the user and the script will end. (Undefined)
● Then the value in the password field should be checked. If the entered password is “KYH” then the Script should continue. Otherwise, it should print an error message to the user and then quit. (If)
● The two names of the people should be saved in an Array. If the user has only entered a name in one of the fields, only one name should be saved in the array. (Array)
● 2 more names must be added as values in the array; the names “Marcus” and “Cihan”. (Push)
● A greeting message to all the names in the array should be printed once for a paragraph tag. (ForEach)
● If the user has chosen to tick repeatedly, the greeting message must be printed again for all persons in the array as many times as the user has entered in their number field. (For)

Your script should also include comments describing the process.
I would like the code to be written as simple as possible, making it easy to read and understand.

Order this or a similar paper and get 20 % discount. Use coupon: GET20

 

Posted in Uncategorized