Hello
I am trying to display the characters |, /, - and \ one after the other in the
same spot, disappearing and being replaced by the next character
so that it looks like a spinning prompt. The spinning prompt should
spin continuously.
so far I have:
<script>
<!--
var i=0;
var flipArray=new Array(4);
flipArray[0]="|";
flipArray[1]="/";
flipArray[2]="-";
flipArray[3]="\\";
for(i=0; i <=3; i++){
document.write(flipArray[i]);
}
//-->
</script>
The result of this is:
|/-\
on my web page.
Just a note, in case anyone is wondering: I am writing in roller and for some
reason if I add the language='JavaScript' type='text/javascript' attributes to the
script tags I get a message that "for" is undefined. Also for some reason in
roller, I'm not allowed to have spaces or blank lines.
How do I get the characters to disappear and the next to appear in the same
spot?
I know that I need to add a setInterval() so that the script will run continuously.
I need to also use setInterval() so that flip()'s output displays in the web page. When I added setInterval() like this:
<script>
<!--
var i=0;
var flipArray=new Array(4);
flipArray[0]="|";
flipArray[1]="/";
flipArray[2]="-";
flipArray[3]="\\";
setInterval("flip()", 500);
function flip()
{
for(i=0; i <=3; i++){
document.write(flipArray[i]);
}
}
//-->
</script>
my characters don't display at all. When I put the setInterval() after the flip()
function, my web page disappears and then my characters display on a
blank screen.
I am working in Apache Roller v. 3 on Windows XP. My browser is Mozilla
but I will also have to have this work in IE.
This is not homework. I was given this task because I know a bit about HTML
although nothing (obviously) about javascript. Fittingly, I am running out to
purchase a "For Dummies" book. Any help anyone might lend would be
greatly appreciated.