
Concept explainers
1) You need to use JavaScript to modify a repeated element of unknown count on the page that is different on each page visit. What is the best way to do this?:
A) Use document.getElementsByTagName(), then use the return like an array. B) Manually label each element Id, then use document.getElementById().
C) Give the same Id to each element, then use getElementById() like an array.
D) Use the highest common parent element, then use recursive search.
2) You are in charge of writing a JavaScript code to tell the user how well his/her password is as it is typed in. What is the best approach?
A) Add onsubmit to submit button. Show message if password is weak and return false.
B) Add onsubmit to submit button. Disable update button if password is too weak.
C) Add onchange to password field. Update a message as password is changed.
D) Add onfocusout to password field. Update a message as password is changed
3) What event can we use to animate a picture once it is downloaded?:
A) onchange
B) onload
C) ondownloaded
D) ongranted

Trending nowThis is a popular solution!
Step by stepSolved in 4 steps

- Find the body:def get_line(board: str, dir: str, col_or_row: int) -> str: """Return the characters that make up the specified row, column, or diagonal from the given tic-tac-toe game board. >>> get_line(4, across, 2) XX >>> get_line(9, down, 3) OOO >>> get_line(4, down_diagonal) OO """arrow_forwardCreate a new file cart.html You must get and set the data on the web page by using document.getElementById( ). Each HTML element on the web page already has an id so it is easy. No need for a loop to go through the list of products, there is only 2 products and the info is hard coded on the web page. You must write the code for function cartTotal().arrow_forwardCreate a new javascript file called cart.js and make a product object for each of your products and store it in a products array when the script loads. Create an empty array to store the items added to the cart. Program the "add to cart button" to take the product id, finds the product object in the products array and adds it to the items added to cart array. Program the "remove from cart button" to take the product id and remove the project object from the items purchased array. Existing code: <!DOCTYPE html><html> <head> <div id="product1" class="card"><img src="img/clorox.jpg"><h1>Clorox</h1><p class="price">$20.00</p><p>Household Cleaner</p><p><button id="product1Btn1">Add to Cart</button></p><p><button id="product1Btn2">Remove from Cart</button></p></div> <div id="product2" class="card"><img src="img/oxiclean.jpg"><h1>Oxiclean</h1><p…arrow_forward
- "As per Bartleby rules, we can answer first 3 MCQ" there are 3 questions ,please answer all thanks !arrow_forwardA student report this problem when using HTML and JavaScript "On the assignment with preloaded images, I had to rewrite the example from the book. I had a problem with the syntax for linking the source file to the <form> element. I solved the problem by using this syntax document images img3.src = (source of file)." What kind of error is it? What rules were applied, and which should have been applied earlier?arrow_forwardWrite a for-loop that will write to the HTML document the value of each element in the array called myArray. Note: You only need to write a for-loop. Code on the outside of the for-loop is not necessary as we will assume that myArray has been declared and initialized with a series of array elements.arrow_forward
- Management has given you the greenlight to create the product portion of the web application. Create a Product class with the following attributes: a. Price b. Name c. Description d. Id Create a ShoppingCart.js file and include it in the products page. In the script, create an empty array to store the items added to the cart. Create a products array and create a product object for each of your products and store it in the products array when the script loads. The shopping cart script should have the following functions: a. add - Takes an id, finds the product object in the products array and adds it to the items purchased array. b. remove - Takes an id and removes the corresponding object from the items purchased array. c. Returns html for displaying the items in the cart. Create a products.html page. Add 5 product images to the page. Under each product add an add to cart button. Make the id property of the button the id for the product.…arrow_forwardHaving trouble with this debugging. new quotes should be visible everytime page loads up.arrow_forwardWrite a javascript program with explanations Use Bootstrap to style the table. The trip data needs to begin as an array literal of object literals, where each trip is an object with 3 properties. The button must have an id property, and using getElementById('id') you must assign the function that displays the table to the button using an anonymous function in your JavaScript code. Rather than use document.write(), you should concatenate the table elements as shown in the examples in the notes for JavaScript objects. If you are ambitious, though, you can get a 10% bonuse if you successfully use createElement() and appendChild(), as discussed in the DOM lecture notes offered later in the course. It is not necessary to use createElement(); concatenation is fine. Before being inserted into a table cell, the mpg must be calculated and not be part of the data objects. round the calculation to 1 decimal placearrow_forward
- What happens when this code runs? newP = document.createElement("p");newP.setAttribute("id", "p3"); newP.innerHTML = "This is a paragraph";document.body.appendChild(newP); A new paragraph saying "This is a paragraph" is inserted at the bottom of the page. A new paragraph saying "This is a paragraph" is inserted at the top of the page.arrow_forwardHi Please write this program using Javascript. Please attach or share a screenshot of the javascript 2. Create an empty <div> element with an id of your name. This element should be used to display your output from JavaScript. 3. Create a JavaScript file with your studentid.js and link it to your HTML file created above. Perform the following exercise in your JavaScript file: a. Declare an empty array that will be used to store integer numbers. b. Write a loop that iterates 30 times. In each iteration of the loop, generate a new random number between 0-50 and insert the value in your array (created above). c. After exiting your loop, display the content of your array in an h2 element inside the div element created in your HTML document, where array elements are separated by the double quote ”. d. Loop through your array and count the instances of numbers 7 and 9 found in your array. As you are looping through the array, also replace each instance of number 3 with your first…arrow_forward7- Determine the output of the following code after clicking the button First div element with class="example". Second div element with class="example". Try it function myFunction () { var x = x[0].innerHTML = "Hello World!"; } document.getElementsByClassName("example");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





