I have an external JS file that holds variables, for example: numberToLevel.js
var number = 1;
And very simply through HTML I want to check the value and change it as the user goes through the navigation.
<script type="text/javascript" src="js/numberToLevel.js"></script>
<script>
if(number == 1){
alert('Success!! ' + number);
}
number = number + 1;
</script>
However, the value of number
doesn't seem to change. the alert is triggered and it does display what it should. However, in the next page I needed it to be 2 instead of 1 and that hasn't happened.
Can anyone please help me?