samedi 31 janvier 2015

JAVASCRIPT if statement won't work

I am making a game where you are supposed to be taken to the second level after you have 10 points on level 1. Here is my function to add points, it has an if statement to take you to the next level (game.html) when your score is 10.



<script>
function addScore(){

scoreDiv = document.getElementById("score");

scoreDiv.innerHTML ++;

if(scoreDiv == 10) {
window.open("Game.html");

}
else {
}
}
</script>


Why isn't it working?


Aucun commentaire:

Enregistrer un commentaire