se usi un elemento fisso nella funzione è naturale che l'effetto venga applicato sempre e solo ad un elemento (e un id deve essere unico in pagina).
Inoltre potresti usare un css o dovrai ripetere lo stile per ciascuna immagine. Così come potresti usare la funzione each di mootools per definire, al DomReady, le funzioni onmouseover/out per tutte le immagini.
Inoltre Fx.Style diventerà Fx.Tween nella prossima release di mootools, ad ogni modo se usi Mootools 1.1 o 1.2.b2 in compatibilità backward va ancora bene
codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>xhtml 1.0</title>
<script type="text/javascript" src="mootools-beta-1.2b2.js"> </script>
<style type="text/css">
a img { filter:alpha(opacity=50); -moz-opacity:0.5; opacity:0.5; border: 0; }
</style>
<script type="text/javascript">
window.addEvent('domready', function() {
$$('a img').each(function(img) {
img.onmouseover = function() {
new Fx.Tween(this, 'opacity', {duration: 500 }).start(0.5,1);
};
img.onmouseout = function() {
new Fx.Tween(this, 'opacity', {duration: 500 }).start(1, 0.5);
};
});
});
</script>
</head>
<body>
[img]Export.jpg[/img]
[img]manu.jpg[/img]
</body>
</html>
Più ordinato e meno ridondante no?
Ciao