aktualisierter Code:
<script type="text/javascript">
var divAnz = document.getElementsByTagName("div").length;
var divs = document.getElementsByTagName("div");
for (var i = 0; i < divAnz; i++) {
divs[i].onClick = Meinefkt;
}
function Meinefkt {
url = this.childNodes[0].src;
text= this.childNodes[0].nodeValue;
...
}
</script>
<body>
<div><img src="url1">text1</div>
<div><img src="url2">text2</div>
<div><img src="url3">text3</div>
</body>