Hello, I have never used javascript seriously until now, since i got my computer (my webserver) taken away and i have been forced to use the webspace provided by my isp, where php (my fav lang) isn't available to me. Hence, Javascript! So, I wanted to make an animated status bar message but I also don't want to use someone else's source and use my own instead. I thought I knew how to do it but there is a strange error. here is the code:
------------------------------------------------------
<script language="Javascript">
var message="welcome to foo.com!";
var i=0;
function main(){
for (i=0;i<=message.length;i++){
setTimeout("window.status=message.substr(0,i)",500);
}
}
</script>
------------------------------------------------------
I did by the way, use the onload="main()" tag in the html's body tag to fire up main(). When the page loads, it waits the half second that it is supposed to wait, but instead of printing the welcome message letter by letter, it prints the whole thing at once!
Help would be greeattly appreciated, I have spent so much time going crazy about this..
------------------------------------------------------
<script language="Javascript">
var message="welcome to foo.com!";
var i=0;
function main(){
for (i=0;i<=message.length;i++){
setTimeout("window.status=message.substr(0,i)",500);
}
}
</script>
------------------------------------------------------
I did by the way, use the onload="main()" tag in the html's body tag to fire up main(). When the page loads, it waits the half second that it is supposed to wait, but instead of printing the welcome message letter by letter, it prints the whole thing at once!
Help would be greeattly appreciated, I have spent so much time going crazy about this..