Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setTimeout function

Status
Not open for further replies.

TyzA

Programmer
Jan 7, 2002
86
BE
Hi,

I have a small script which just fades in random text and fades it out again.

To do this I had to use the setTimeout funtion.

I work with a frameset in which one frame holds the javescript with the fading, another one holds an input form.

The problem I have is that my cursor in my first input field of the form blinks very fast. I this is cause by the setTimeout function because it's set to 250 to get a good result.

Is there any way to get that cursor not to blink that fast, but keep my timeout at 250?

Here is my script:

//--------------------------------------------------------
var message = "uuuuuuuuuuuuuu" // Initial message
//--------------------------------------------------------

var next = 0 ;
var fade = 0 ;
var fadeIn = true;

//--------------------------------------------------------
// Array list: here you can add new, extra messages

var next_message = new Array ("hhhhhhhhh","bbbbbbbbb","vvvvvvv","aaaaaaaaa","ssssssssss","eeeeeeeeeeee","ppppppppp","...");
//--------------------------------------------------------

function doText(message) {
teletext.innerHTML = message;
fader();

//--------------------------------------------------
parent.navigation.setTimeout("doText(message)", 100); // Set the timeout between each letter
//--------------------------------------------------
}

function fader() {

if (fadeIn)
{
fade += 4;

if (fade == 100)
{
fadeIn = false;
}
}
else
{
fade -= 4;

if (fade == 0)
{
fadeIn = true;
nextMessage();
}
}
teletext.filters.alpha.opacity = fade;
}

function nextMessage() {
var maxmsg = next_message.length -1
var msgLength = next_message.length
message = next_message[next]

if (next == maxmsg) {
next = 0;
fade = 0;
}
else{
next=(Math.round(maxmsg*Math.random())%msgLength); // generate the next message randomly
fade = 0;
}
}
// End -->

Thanks for any info,

Tijs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top