
Concept explainers


Algorithm: User Input and sessionStorage
1. Start
2. Create an HTML document.
3. Add the necessary HTML structure:
a. Create an input field with an id of "username" and a placeholder text.
b. Create two buttons with ids "storeButton" and "retrieveButton".
c. Create a paragraph element with an id of "output".
4. Add a script section inside the HTML document.
5. Inside the script section, define the following functions:
a. `storeUsername` function:
i. Get the value of the input field with the id "username".
ii. Check if the entered username is not empty.
iii. If the username is not empty, store it in sessionStorage with the key "username".
iv. Display a message indicating that the username has been stored in sessionStorage.
v. If the username is empty, display an error message.
b. `retrieveUsername` function:
i. Retrieve the username from sessionStorage using the key "username".
ii. Check if a username was found in sessionStorage.
iii. If a username is found, display it on the page.
iv. If no username is found, display a message indicating that no username is stored in sessionStorage.
6. Add event listeners to the "storeButton" and "retrieveButton" elements:,a. Create an input field with an id of "username" and a placeholder text.
b. Create two buttons with ids "storeButton" and "retrieveButton".
c. Create a paragraph element with an id of "output".
4. Add a script section inside the HTML document.
5. Inside the script section, define the following functions:
a. `storeUsername` function:
i. Get the value of the input field with the id "username".
ii. Check if the entered username is not empty.
iii. If the username is not empty, store it in sessionStorage with the key "username".
iv. Display a message indicating that the username has been stored in sessionStorage.
v. If the username is empty, display an error message.
b. `retrieveUsername` function:
i. Retrieve the username from sessionStorage using the key "username".
ii. Check if a username was found in sessionStorage.
iii. If a username is found, display it on the page.
iv. If no username is found, display a message indicating that no username is stored in sessionStorage.
6. Add event listeners to the "storeButton" and "retrieveButton" elements:
a. When the "storeButton" is clicked, call the `storeUsername` function.
b. When the "retrieveButton" is clicked, call the `retrieveUsername` function.
7. End
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 3 images

- You create a variable in RStudio. Where can you see created values listed? Question 3 options: Environment pane Terminal Console Jobs tabarrow_forwardThe mode portion of the command format is made up of the following parts: Category of users you are working with: u = user, g = group, o = other or a = all Permissions: r = read, w = write or x = execute Assume the file, pfile1, has the following permissions, r----x-w-. Use symbolic mode to change the permissions to rwxrw-r--.arrow_forwardEvent Listeners Return to the mas_register.js file in your editor. Directly below the initial comment section, insert an event listener for the window load event. Run an anonymous function in response to the event containing the following commands: Call the calcCart() function (which you will create shortly.) Create an onclick event handler for the regSubmit button that runs the sessionTest() function when the button is clicked. Create onblur event handlers for the input boxes with the ids: fnBox, lnBox, groupBox, mailBox, phoneBox, and banquetBox, running the calcCart() function in response to each event. Create an onchange event handler for the sessionBox selection list, running the calcCart() function when the selection list is changed. Create an onclick event handler for the mediaCB check box, running the calcCart() function in response. JavaScript Functions Create the sessionTest() function. The purpose of this function is to provide a validation test for the conference session…arrow_forward
- A user account “user1” has a primary group of “user1”. Write the command that will change the primary group of thisuser account from “user1” to “user2”.arrow_forwardUnicornBox stores some configuration variables in a config.yml file in a folder separate from the users’ files: The layout of the server storage is as follows: site/ file/ foo1.txt foo2.txt ... config/ config.yml Your task: Gain access to the secrets stored within config.yml. Tip: Most browsers modify URLs before they are truly actually sent to the server. If you are having trouble determining what URLs are sent to the server, consider using the Network tab of your browser’s debugger. Tip: What happens if you try to access a file that your user account doesn’t have access to? Consider what has to be true before a file is “served” from the file system in this website.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





