Global Click Variables

Global Click Variables

Is there a way to have a global variable that survives multiple click functions?

As a test, the following does not seem to work:
<script language="JavaScript">  $(document).ready(function() {  alert("ready");  var GPSloc = 0;  $("#FlipLoc").click(function(e) {  alert("GPSloc="+GPSloc);  if (GPSloc==0) {  GPSloc = 1;  } else {  GPSloc = 0;  }  alert("gpsLOC="+GPSloc);  });  });  </script>


FlipLoc is a standard HTML anchor but the value for GPSloc does not change across invocations.