<script type="text/javascript">
function clic() {
// foo <- variable static à la fonction
if (typeof(this.foo)=="undefined") {
alert("init")
this.foo = 0; // declare and init variable static
} else {
foo++;
}
alert(foo);
}
</script>
<button onclick="clic()">variable static ++</button>