Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using JS and HTML. The web page rock-paper-scissors.html must now include a placeholder for the graphical results. This placeholder can be a table element with

Using JS and HTML. The web page rock-paper-scissors.html must now include a placeholder for the graphical results. This placeholder can be a table element with two rows and three columns. The first row acts as a table header; it has three cells that must contain Human, Computer, and Wins. The second row is where the results are to be stored. The function play of the final version must make three calls to the function displayResult(what, where). The parameters what and where indicate the contents of the result and the table cell where it must place it (i.e., the id of the HTML element that the JavaScript program will modify), respectively. Create a JavaScript file called rps.js and store these functions in it. We identify an HTML element using an id. For instance, we identify a div as target using

so that we can later search it in the whole HTML document. document.getElementById(target) searches for the element identified as target and returns it so that it can be used, assigned to a variable, etc. We can modify any previously identified web page element by assigning a value to its innerHTML property. In a single instruction: document.getElementById(elementID).innerHTML = newContent; where elementID is a string variable that stores the target element id, and newContent is the variable that stores the new content for that element. Generally, newContent is a string that represents HTML code.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions