Extra 8-2 Develop a password generator……solved

$20.00

Category:

Description

5/5 - (2 votes)

In this exercise, you’ll develop an application that generates strong passwords of the length entered by the user. The interface looks like this:
*Image in file*
*Must use code in file*
1. Open the HTML and JavaScript files in this folder:
exercises_extrach08password
1. In the JavaScript file, note that five functions are supplied. The $ function. The getRandomNumber function. The start of a generatePassword function. A clearFields function that resets the text boxes and moves the focus to the first text box. And an onload event handler that attaches the generatePassword and clearFields functions to the click events of the related buttons.
2. In the generatePassword function, get the value entered by the user and make sure it’s a number. If it isn’t, display an alert box with this message: “Please enter a valid number”.
3. If the number entered by the user is valid, code a for loop that iterates that number of times. In each iteration of the loop, randomly select one of the characters from the chars variable and concatenate it to the password variable.
4. When the loop is finished, display the password in the password textbox.