Does javascript reverse / forward variables change in browser?
2 answers
As pointed out in another question , the real answer to this question is browser dependent .
Firefox Opera 1, Set x, , . Chrome IE6 , x 0.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<input type="button" id="button" value="Set x">
<input type="button" id="check-x" value="Check x">
<a href="http://www.stackoverflow.com">Click Me</a>
<script>
var x = 0;
$("#button").click(function(){
x = 1;
});
$("#check-x").click(function(){
alert(x);
});
</script>
+20