Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!