[thelist] Re: JavaScript question

Ishmael74 at aol.com Ishmael74 at aol.com
Thu Oct 10 23:38:01 CDT 2002


--
[ Picked text/plain from multipart/alternative ]
hello to who is reading this,

first, thaks for continuing to read this. ive taken the <> of the tags.. so
hopefully this is considered plain text.. if not sorry. thought i might see
if you could help me here on something trivial, and not-so-useful.
basically...ive been coding javascript for about a month as i build my first
website... and i'm going through a book that gave me this exercise. simple
enough i thought. its based on the setTimeout() / clearTimeout() methods.
here's what the exercise says to do:

                            int the  <head> section create a function that
                            displays a message in the status bar three times,
                            clearing it between each time it is displayed.
each time
                            the message is shown, it should be visible for
400
                            milliseconds and and remain invisible for 200.
when the
                            flashing is done, the message should be visible
                            in the status bar. the function should be called
in
                           <body onLoad="myFunction()">

knowing that these are automatic methods that can't be manipulated... i tried
to use a counter that didnt work... it does nothing in the code now.. i tried
to use it in a if statement but i get errors and the giant for loop doesnt
work either. i don't really want anything to blink on a page but its the
principle of understanding how to manipulate set/clearTimeout(). they only
way i could control set and clear was to create a button, but as i said, this
exercise seems to want an automatic process. sorry to trouble you with this
and thanks for taking the time if you decide to try it out.

thanks,

wyatt

SCRIPT LANGUAGE="JavaScript"

// USE THIS CODE BLOCK FOR SCRIPTS PUT IN THE <HEAD> SECTION

//window.document.write("your current url: " + window.location);

var msg = "hello there, i'm here";
var i = 1;
counter = 0;
function flashStat()
{
for(i=0; i<3; i++)
{
if(i)
{
 status = msg;
 i = 0;
 counter = counter++;
}
else
{
 status = " ";
 i = 1;
 clearTimeout("flashStat()", 200);
 return true;
}

id = setTimeout("flashStat()", 4000);
return true;
}
}
status = msg;

/SCRIPT
/HEAD

BODY onLoad="myFunct



More information about the thelist mailing list