In my college assignment, I'm working on a website about the game of rock, paper, scissors, lizard, Spock from The Big Bang Theory. The requirements are to use HTML, CSS, and JavaScript only, so please don't suggest JQuery as it's not allowed. While my HTML and CSS are fine, I need help with incorporating JavaScript, which is new to me.
I've set up a combo box with options for Rock, Paper, Scissors, Lizard, and Spock. Below that, I have three text boxes on the page. Currently, I'm able to use JS to get the selected value from the combo box and display it in the middle box. However, I'd like to also show what beats the selected option in the first box and what it beats in the third box. For example, if "Rock" is chosen, "Paper" should go in the first box and "Scissors" in the third box.
I want these values to update dynamically based on the selection from the combo box. Here's the HTML structure so far:
<!Doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css"
href="Web.css">
<script>
function Choice()
{
var mylist=document.getElementById("myList");
document.getElementById("Choice").value=mylist.options[mylist.selectedIndex].text;
var x= Choice.value;
}
</script>
...
</body>
</html>
Your guidance would be appreciated. Thank you, Chris