<html>
<head>
<script type="text/javascript">
var f = function() {
var staticVar = 0;
return function() {
alert( "Function was called " + ++staticVar + " times" );
}
}();
</script>
</head>
<body>
<input type="button" value="+" onclick="f()">
</body>
</html>