I use a code like this:

```
<div id="div2" onclick="alert(0)" >On click must return 2</div>
<div id="div3" onclick="changeClick(2);">On Click change return of DIV2 click to 2</div>

```

.

```
function changeClick(i){
 document.getElementById('div'+i).onclick = function(){alert(i)};
 i=9;
}

```

but I want to respond to the click 2 and not 9 like:

```
document.getElementById('div'+i).onclick = function (){alert(2);};

```

(i=9) is for simulate a real condition of my real function, because (i) increment in a loop for change many div.
Is not possible use of if or switch statement.