Visualizzazione dei risultati da 1 a 3 su 3

Discussione: Script sposta testo

Visualizzazione discussione

  1. #1

    Script sposta testo

    Ciao a tutti, ho realizzato uno script che dovrebbe spostare il testo da una casella ad un altra se presente, ma non funziona.
    codice:
    <html>
    <head>
    <title>Programma</title>
    </head>
    <body>
    <form>
    <fieldset>
    <legend>Sposta testo</legend>
    <input type="text" name="casella">
    <input type="text" name="casella2">
    <input type="button" value="Sposta il testo" onclick="sposta()">
    </fieldset>
    </form>
    </body>
    <script>
    function sposta()
    {
    var stringa = casella 2.value;
    if(casella.value.length > 0)
    {
    stringa = document.casella2.value;
    document.casella2.value = document.casella.value;
    }
    if(stringa.length > 0)
    {
    document.casella.value = stringa;
    }
    }
    </script>
    </html>
    chi mi aiuta?
    Ultima modifica di wormd; 02-02-2014 a 16:42
    ?

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 © 2025 vBulletin Solutions, Inc. All rights reserved.