Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    News scorrevoli con pulsanti

    Ciao a tutti

    Ho un problema volevo realizzare delle news che si muovessero solo con i pulsanti "su" e "giù" e fin qui ci sono riuscita utilizzando javascript
    Posto il codice:
    <html>
    <head>
    <title>Untitled</title>
    <script language="javascript">
    function goDown()
    {
    //Find Element
    var element = document.getElementById("test");
    var container = document.getElementById("container");
    //Modify Element position
    var containerHeight = container.offsetHeight;
    var size = element.style.top;
    size = size.substring(0, size.indexOf("px"));
    if (size<containerHeight-10)
    {
    size = parseInt(size) + 10;
    element.style.top = size + "px";
    }
    }

    function goUp()
    {
    //Find Element
    var element = document.getElementById("test");
    //Modify Element position
    var size = element.style.top;
    size = size.substring(0, size.indexOf("px"));
    if (size>0)
    {
    size = parseInt(size) - 10;
    element.style.top = size + "px";
    }
    }
    </script>
    </head>

    <body>

    <table width="40%" height="40%">
    <tr>
    <td colspan="2" style="border: 1px solid green;" valign="top">
    <div id="container" style="overflow: hidden;">
    <div id="test" style="position: relative; top:0px; left:0px;">



    Prova

    Prova1

    Prova2

    Prova

    Prova1

    Prova2</p>


    Prova

    Prova1

    Prova2</p>


    Prova

    Prova1

    Prova2 </p>
    </div>
    </div>
    </td>
    </tr>
    <tr>
    <td><input type="button" value="Su" onClick="goUp();"></td>
    <td><input type="button" value="Giù" onClick="goDown();"></td>
    </tr>
    </table>

    </body>
    </html>
    Il mio problema è che le news non ruotano mi spiego meglio..Se aggiungo nuove news la mia tabella si allunga, invece io volevo che al premere del bottone si passasse alla nuova news e la vecchia scomparisse...
    Qualcuno a qualche suggerimento..?
    Grazie mille

  2. #2
    :quote: nessuno sa darmi una mano.....

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.