All,

First I am a amateur with JavaScript but I trying to fix that. I am working on a Rock Paper Scissors game and I have ran into one issue. The logic of the game works but I am trying to add an error check for when the player 1 or player 2 enters the data.

Logic -
User must enter Rock or Paper or Scissors if they enter rock or paper or scissors they will be asked to enter their selection again and be reminded it is case sensitive.

Problem-
I have tried to use a while loop but the game never runs and it never makes it to the alerts. I have used an IF statement and the game works but it does not prompt the user to enter their choice again if the first letter is not in capitalized.

At this point I am lost and any help would be greatly appreciated.

Code -
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<title> Paper - Rock - Scissors </title>
<link rel="stylesheet" href="extraCredit.css" />

<script>

function playGame(){

var firstPlayer = document.getElementById("p1").value;
var secondPlayer = document.getElementById("p2").value;




if(firstPlayer != "Rock" && firstPlayer != "Paper" && firstPlayer != "Scissors"){
document.getElementById("repeat").innerHTML= "Enter Rock - Paper - Scissors. **It is case sensitive**";

alert(firstPlayer);
}

if(secondPlayer != "Rock" && secondPlayer != "Paper" && secondPlayer != "Scissors"){
document.getElementById("repeat").innerHTML= "Enter Rock - Paper - Scissors. **It is case sensitive**";

alert(secondPlayer);
}


if(firstPlayer === secondPlayer){
document.getElementById("repeat").innerHTML= "tie";
}else{
if(firstPlayer === "Paper" && secondPlayer === "Rock" || firstPlayer === "Rock" && secondPlayer === "Scissors" || firstPlayer === "Scissors" && secondPlayer === "Paper"){
document.getElementById("repeat").innerHTML= "First Player Wins";
}else{
document.getElementById("repeat").innerHTML= "Second Player Wins";
}
}


}

</script>


</head>
<body>


<h1> Paper - Rock - Scissors</h1>
<p> Enter Paper Rock or Scissors. ***It is case sesonsitive***.</p>
<h3><img src="rock-paper-scissors.jpg" alt="Rock-Paper-Scissors" /></h3>
<h4 id = "repeat">&nbsp;</h4>



player 1: <input id = "p1" type="text" name="firstPlayer">
player 2: <input id = "p2" type="text" name="secondPlayer">
<input onclick = "playGame()" type="submit" value="Submit">



<footer class="footer">
<p> <medium> Choose Your Weapon Image: Take from www.prlog.org.</medium></p>
<p><small>&copy; 2013 Mark C Lowrey. All Rights Reserved.</small></p>

</footer>
</body>
</html>