<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<table>
<tr>
<td>Информация 1</td>
<td><img class='test' src="test.jpeg" /></td>
</tr>
<tr>
<td> Информация 2</td>
<td><img class='test' src="test.jpeg" /></td>
</tr>
<tr>
<td>Информация 3 </td>
<td><img class='test' src="test.jpeg" /></td>
</tr>
</table>
<script>
(function () {
var tds = document.querySelectorAll('table tr td:first-child'),
imgs = document.querySelectorAll('table img'),
onImgClick = function (i) {
return function () {
alert(i);
}
};
for (var i = 0; i < imgs.length; i++) {
var info = tds[i].innerHTML;
imgs[i].onclick = onImgClick(info);
}
})()
</script>
</body>
</html>