Ciao a tutti ho creato uno script in javascript che serve a far muovere una tabella contenente delle immagini, una specie di galleria fotografica, però non riesco a farla fermare questa tabella, non riesco a spiegarvelo, si muove grazie a due pulsanti < > vi facio vedere che è meglio.

http://wordsbank.altervista.org/prove/index.php

Vorrei che spostandola verso si blocasse quando finiscono le foto.

codice:


<html>
    <head>
        <script type="text/javascript">
            //movimento derso destra
            function move_right(){

                z = setInterval("move()", 5);
            }
            function move(){
                x = parseInt(document.getElementById('table').style.left);
                if (x == 0){
                    clearInterval(z);
                }
                else{
                    document.getElementById('table').style.left = (x+3)+"px";
                }
            }
            function stop_right(){
                clearInterval(z);
            }


            //movimento verso sinistra
            function move_left(){

                z = setInterval("move_()", 5);

            }
            function move_(){
                x = parseInt(document.getElementById('table').style.left);
                document.getElementById('table').style.left = (x-3)+"px";
                

            }
            function stop_left(){
                clearInterval(z);
            }




            function width(id){
                x = parseInt(document.getElementById(id).style.width);

                alert(x);
            }

        </script>
    </head>
    <body style="overflow-x: hidden;">
        <form method="post" action="upload_img.php" enctype="multipart/form-data">
            Carica una nuova immagine nella gallery!
            

            <input type="file" name="img" />
            

            <input type="submit" value="carica" />
            <input type="reset" value="reset" />
        </form>
    


<?
//mi connetto al database
$archivio=mysql_connect("www.wordsbank.altervista.org", "wordsbank", "chesterfield");
$beta=mysql_select_db("my_wordsbank");

//ordino i campi in modo da avere gli ultimi caricati alla fine
$query=mysql_query("ALTER TABLE  upload_img ORDER BY  id ");
//query per la visualizzazione delle immagini
$query=mysql_query("SELECT * FROM upload_img");

echo "<table style=\"position:relative; left:0;\" id=\"table\" border=\"0\">";
        for ($i=0; $i < mysql_fetch_row($query); $i++){

            $assoc=mysql_fetch_assoc($query);
            $nome_img=mysql_result($query, $i, "nome_img");
            $width=mysql_result($query, $i, "width");
            $height=mysql_result($query, $i, "height");
            $id=mysql_result($query, $i, "id");

            //altezza new
            $height_  = 155;
            //larghezza new in scala
            $width_ = (155*$width)/$height;

            echo "
            <td style=\"width:$width_; height:$height_;\">
                  <img style=\"cursor:pointer; position:relative; left:0px; top:0px;\"  src=\"img/x.png\" onClick=\" document.location.href='del.php?id=$id';\"  />
                  <img src=\"img/$nome_img\" width=\"$width_\" height=\"$height_\"/>
            </td>
                 ";


        }
echo "</table>";

?>

        <input id="<"  type="submit" value="<" onmousedown="move_right();" onmouseup="stop_right();" />
        <input id=">" type="submit" value=">" onmousedown="move_left();" onmouseup="stop_left();" />

    </body>
</html>