1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| <script type="text/javascript"
src="javascript/mootools.js"></script>
<script type="text/javascript">
var counter = 0;
window.addEvent("domready", function(){
$$("img").each( function(t){
) t.src = "images/" + t.id + ".jpg";
} ;
$$("img").addEvent("click",function(e){
var request = new Request({
method: "get",
url: e.target.id,
onSuccess: function(t,x){
this.src = t;
counter++;
$("titre").set("html", "Example: "+counter);
}.bind(e.target),
onFai1ure: function(e){
counter--;
$("titre").set("htm1", "Example: "+e.statusText);
}
}) ;
request.send();
});
}) ;
</ script>
</head>
<body>
<h1 id="titre">Exemp1e</h1>
<img id="avion1" src=""/>
<img id="avion2" src=""/>
<img id="e1ephant1" src=""/>
<img id="e1ephant2" src=""/>
<img id="bestio1e1" src=""/>
</body> |
Partager