
Concept explainers
Please, I need help with this assignment, please. I pasted the HTML file and JavaScript file at the bottom of the instruction. Thank you so much.
Murach's JavaScript and jQuery 4th edition by MARY DELAMATER (Chapter 12)
Develop a password generator
In this exercise, you’ll develop an application that generates strong passwords of the length entered by the user.
1. In the JavaScript file, note the getRandomNumber() function. Also, note that the ready event handler contains the handler for the click event of the Get Password button and the handler for the click event of the Clear button.
The handler for the Get Password button clears the password text box and has a
constant named chars that contains some characters. The handler for the Clear button resets the text boxes and moves the focus to the first text box.
2. In the handler for the Get Password button, get the value entered by the user and make sure it’s a number. If it isn’t, display an alert dialog 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 constant and concatenate it to the password variable.
4. When the loop is finished, display the password in the password textbox.
JAVASCRIPT FILE
"use strict";
const getRandomNumber = max => {
let random = null;
if (!isNaN(max)) {
random = Math.random(); // value >= 0.0 and < 1.0
random = Math.floor(random * max); // value is an integer between 0 and max - 1
random = random + 1; // value is an integer between 1 and max
}
return random;
};
$(document).ready( () => {
$("#generate").click( () => {
$("#password").val( "" ); // clear previous entry
const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-+!@";
}); // end click()
$("#clear").click( () => {
$("#num").val( "" );
$("#password").val( "" );
$("#num").focus();
}); // end click()
// set focus on initial load
$("#num").focus();
}); // end ready()
HTML FILE
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Password Generator</title>
<link rel="stylesheet" href="password.css">
</head>
<body>
<main>
<h1>Generate a strong password</h1>
<div>
<label for="num">Number of characters:</label>
<input type="text" id="num">
</div>
<div>
<label for="password">Password:</label>
<input type="text" id="password" disabled>
</div>
<div>
<label></label>
<input type="button" id="generate" value="Get Password">
<input type="button" id="clear" value="Clear">
</div>
</main>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>
<script src="password.js"></script>
</body>
</html>

Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images

- Thank you very much for your help. I do need the btnSubmitPrice to work when clicked though, and via the assignment given, I cannot have an InputBox unless I am also allowed to have the btnSubmitPrice to be clicked when a user adds another item. When a user adds another item, the txtTotalSales and txtAverageSalePrice have to change as well and update with the new values. I do not know how to do this. I tried moving the text under btnSubmitPrice_Click instead of FrmMain_Load and it did not work.arrow_forwardNeed help with coding this in python using tkinter Write a GUI program to let the user enter a file name from an entry field and then count the number of occurrences of each letter in that file. Clicking theShow Result button displays the result in a text widget. You need to displaya message in a message box if the file does not exist. https://www.bartleby.com/questions-and-answers/need-help-with-coding-this-in-python-using-tkinter-write-a-gui-program-to-let-the-user-enter-a-file-/153862b8-6d38-47a4-bd38-9c66882021d1arrow_forwardPLEASE DONT COPY OFF OTHER POSTS CODE help with java..plzz paste indented code add comments tooarrow_forward
- Please help me with these question. I am having trouble understanding what to do. Please use HTML, CSS, and JavaScript Thank youarrow_forwardWe want to display the following message to user of our Android app:Message: Your file has been deleted.Write the Java statement needed to display the above message.arrow_forwardKindly Note:-Don't try to copy other's work otherwise I'll reduce rating for sure and will report. Don't use AI to generate answerarrow_forward
- Create an anonymous block that returns the number of students in a section. Prompt for section id.B. Create an anonymous block that return the average numeric grade for a section. Prompt for sectionid and return the average grade.arrow_forwardOpen the application in the folder under the coursework. Open the HTML file and notice that an Invoice Date field has been added. Then, open the HTML file and notice that it includes a getFormattedDate() function that formats the Date object that’s passed to it in MM/DD/YYYY format and then returns the date string. Start the application, enter a subtotal, and click the Calculate button. Note that nothing is displayed in the Invoice Date field. In the click() event handler for the Calculate button, add code that gets the current date and formats it using the getFormattedDate() function. Then, add code that provides a default value of the formatted current date for the invoice date. Note that if an invoice date is entered, that date isn’t validated. Add code that sets the value of the Invoice Date field. If you’ve done this right, the application should display the current date when you click the Calculate button without entering anything in the Invoice Date field. <!DOCTYPE…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





