The game runs fine but I am having trouble continually keeping score and adding 1 to the textfields based on if it is a win, tie or loss. The textfields id's are 'won' 'lost' and 'tied'.


window.onload = init;
function init(){

document.getElementById("rock").onclick = game;
document.getElementById("paper").onclick = game;
document.getElementById("scissors").onclick = game;
document.getElementById("lizard").onclick = game;
document.getElementById("spock").onclick = game;

}


function game(){

var compGuess;
var cchoice;
var pchoice;
var won = 0;
var lose = 0;
var tie = 0;



compGuess = (Math.floor(Math.random() * 5)) + 1;

switch (compGuess){
case 1:
cchoice = "rock";
break;
case 2:
cchoice = "paper";
break;
case 3:
cchoice = "scissors";
break;
case 4:
cchoice = "lizard";
break;
case 5:
cchoice = "spock";
break;
default:
message = "Error";
break;
}//end switch

pchoice = (this.id);

//ROCK
if (pchoice=="rock" && cchoice=="scissors"){
document.getElementById('won').value = won++;
//alert("Rock beats the scissors. YOU WIN!!")

}
else if (pchoice=="rock" && cchoice=="paper") {
document.getElementById('lost').value = lose++;
// alert("Paper beats rock...idk how that works but. YOU LOSE")

}
else if (pchoice=="rock" && cchoice=="lizard") {
document.getElementById('won').value = won++;
//alert("Rock crushes lizard. YOU WIN!!")

}
else if (pchoice=="rock" && cchoice=="spock") {
document.getElementById('lost').value = lose++;
// alert("Spock vaporizes rock. YOU LOSE")

}
else if (pchoice=="rock" && cchoice=="rock") {
document.getElementById('tie').value = tie++;
// alert("You both picked rock. YOU TIED")

}