Navilsor,
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script>
document.onclick = function (a) {
var a = a || window.event,
a = a.target || a.srcElement,
b = a.parentNode;
if (a.nodeName.toLowerCase() == "img") {
for (var c = 0, a = a.previousSibling; a && a != b;)
a.nodeName.toLowerCase() == "img" && c++, a = a.previousSibling;
xmodel.innerHTML = [10, 20, 30][c]
}
};
</script>
</head>
<body>
<img src="simple1.jpg" id="image1" border="2"/>
<img src="simple2.jpg" id="image2" border="2"/>
<img src="simple3.jpg" id="image3" border="2"/>
<td> Значение:<span id="xmodel">0</span> руб.</td>
</body>
</html>