Please don’t test this code at your PC, because that will lead into several PC crashes. Something is wrong with the loop…
The meaning of this code is that it writes some sentence (sentence=zin in dutch), letter by letter. After is has finised a sentence, it goes to the next sentence (next arraykey).
Testing the code gives a “unknown error” at the line of
[CODE]setTimeout(“talk()”,150);
[B]Coding:
[CODE]
<script language=”javascript”>
var zin = new Array();
zin[0] = “text 1”;
zin[1] = “Text 2”;
zin[2] = “Text 3”;
function talk()
{
var x = 0;
var nummer = 0;
while (nummer != zin.length)
{
var spreekzin = zin[nummer].substring(0,x);
document.getElementById(“praatballon”).value=spreekzin;
if (x == zin[nummer].length)
{
nummer++;
x= 0;
}
else
{
x++;
setTimeout(“talk()”,150);
}
}
}
</script>
<input type=”text” id=”praatballon” readonly=”readonly” style=”width: 300px; height:50px;” value=”” onclick=”talk()”>