Ok, I've spent at least 10 hours tinkering, researching, filtering results on how to get this to work, but am unsuccessful, I'm tired of this frustration and hopefully someone can help me out real quick.
I want to print each letter from a string one by one, using setTimeout (like it's being typed as you read)
this is what I got...
Code:
var type;
function writeText()
{
var message = "this is the message";
var messageChars = new Array();
for (var i=0;i<message.length;i++)
{
messageChars[i] = message.charAt(i);
}
for(var i=0; i<message.length; i++)
{
type = setTimeout("document.write("+messageChars[i]+");", 500);
}
}
now when I run this, and go to the error console in FF, it tells me "t, h, i, s; is not defined" Each one is not defined, and the page is constantly loading, and nothing displays on the screen.
now I've tried multiple variations of this script, including calling a function passing the character to it, and having that display each character.
I even went as far as to just using that last for loop to document.write("a"), and each time I get "a is not defined"....which makes no darn sense as to it's a character.....
so please, please show me what I'm doing wrong, wasting 10 hours for something this silly disturbs me.
|