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?