<html>
        <head>
                <script type="text/javascript">
                        nom = '';
                        function affiche(){
                                for(var i=0; i<document.images.length;i++){
                                        document.images[i].onclick=function(){nameImage(this.alt)}
                                }
                        }
                        function nameImage(text){
                                nom = text;
                                test()
                        }
        /*                function test(){
                                alert(nom);
                        }*/
                </script>
        </head>

        <body onload="affiche()">
                <img src="im_1.jpg" name="images1" width="256" height="192" border="1" alt="im_1">
                <img src="im_2.jpg" name="images2" width="609" height="457" border="1" alt="im_2">
        </body>
</html>