<script type="text/javascript">
var variables = {
a1: 0,
a2: 0,
a3: 0
};
function x(b) {
variables["a" + b] = 1;
alert("a" + b + " = " + variables["a" + b]);
}
</script>
<button onclick="x(1)">1</button>
<button onclick="x(2)">2</button>
<button onclick="x(3)">3</button>
-------
опоздал