mpalmer12345
Programmer
I am trying to print out the letters of MYtext one at a time at 1 second intervals. This doesn't work, all I get is the first letter, then it stops. My grasp of setTimeout is very shaky, it seems.
<HTML>
<HEAD>
<script language="JavaScript">
<!--
MYtext = "black";
function changeTX(var ii) {
MYlen = MYtext.length;
MYsub = MYtext.substring(ii, ii + 1);
document.write(MYsub + " " + xx + "<BR>");
}
var ii = 0;
function newTX(){
while (ii < 10) {
var newtext = setTimeout("changeTX(ii)", 1000);
ii += 1;
}
}
//-->
</script>
</HEAD>
<BODY BGCOLOR=#FFFFFF onLoad="newTX()">
</BODY>
</HTML>
<HTML>
<HEAD>
<script language="JavaScript">
<!--
MYtext = "black";
function changeTX(var ii) {
MYlen = MYtext.length;
MYsub = MYtext.substring(ii, ii + 1);
document.write(MYsub + " " + xx + "<BR>");
}
var ii = 0;
function newTX(){
while (ii < 10) {
var newtext = setTimeout("changeTX(ii)", 1000);
ii += 1;
}
}
//-->
</script>
</HEAD>
<BODY BGCOLOR=#FFFFFF onLoad="newTX()">
</BODY>
</HTML>