JavaScript Within the script section create two global variables: one named i with a value of , and the other named listItem with its value set to an empty string.. Below the variables, create a function called processInput(). Within the function, create an if statement that runs if the value of i is less than or equal to . The ifstatement should perform the following actions: a. Set the value of the listItem variable to the string “item” concatenated with the value of i. b. Set the content of the element with an id equal to listItem to the value of the element with the id of toolbox.c. Set the value of the element with the id of toolbox to an empty string.. Before the closing } of the if statement, create a nested if statement. If the value of i is equal to , the statement should change the content of the element with the id of resultsExpl to the string “Thanks for your suggestions.”. Before the closing } of the main if statement, after the nested if statement, add a statement to increment the value of i by .. Add a backward-compatible event listener for the click event to the Submit button

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter5: Making Decisions
Section: Chapter Questions
Problem 10PE
icon
Related questions
icon
Concept explainers
Question

JavaScript

Within the script section create two global variables: one named i with a value of , and the other named listItem with its value set to an empty string.. Below the variables, create a function called processInput(). Within the function, create an if statement that runs if the value of i is less than or equal to . The ifstatement should perform the following actions: a. Set the value of the listItem variable to the string “item” concatenated with the value of i. b. Set the content of the element with an id equal to listItem to the value of the element with the id of toolbox.c. Set the value of the element with the id of toolbox to an empty string.. Before the closing } of the if statement, create a nested if statement. If the value of i is equal to , the statement should change the content of the element with the id of resultsExpl to the string “Thanks for your suggestions.”. Before the closing } of the main if statement, after the nested if statement, add a statement to increment the value of i by .. Add a backward-compatible event listener for the click event to the Submit button (with the id of button).. Add comments to document your work, and then save your work. Open index.htm in a browser, type the name of a tool in the text box, and then click Submit. The name of the tool you typed is added to the bulleted list on the right side of the web page. Enter the names of four more tools, clicking Submit after each one. After you enter the fifth name, the text “Thanks for your suggestions.” is displayed below the bulleted list.

Here is the code I hve to start

My code for the solution

<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width,initial-scale=1.0"> <title>Hands-on Project 3-4</title> <link rel="stylesheet" href="styles.css" /> <script src="modernizr.custom.05819.js"></script> </head> <body> <header> <h1> Hands-on Project 3-4 </h1> </header> <article> <div id="results"> <ul> <li id="item1"></li> <li id="item2"></li> <li id="item3"></li> <li id="item4"></li> <li id="item5"></li> </ul> <p id="resultsExpl"></p> </div> <form> <fieldset> <label for="toolBox" id="placeLabel"> Type the name of a tool, then click Submit: </label> <input type="text" id="toolBox" /> </fieldset> <fieldset> <button type="button" id="button">Submit</button> </fieldset> </form> </article> </body> </html>

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage