Ciao sto scrivendo un piccolo script di battitura stile macchina da scrivere:
codice:
<html>
<head>
<script language="JavaScript">
var lista = new Array();
var i = 0;
var attesa = 20;
var c = 0;
var s = "";
function type(testo) {
lista[i++] = testo;
s = lista[c].substring(0,s.length+1);
document.txt.msg.value=s + " _";
if (s.length==lista[c].length) {
s = "";
c = 0;
i = 0;
return true;
}
var id = setTimeout("type()",attesa);
}
</script>
</head>
<body>
<a onMouseOver="type('Categoria sulla pasta')">test</a>
<a onMouseOver="type('Categoria sulla frutta')">test</a>
<form name="txt">
<textarea NAME="msg" rows="30" cols="30" readonly></textarea>
</form>
</body>
</html>
Il mio problema è che va in errore nel momento in cui esco dal primo A entrando nel secondo senza che il primo sia finito.
Avete idea di come ovviare a questo inconveniente?