[Javascript] A Timed removal of DOM elements

Peter Brunone peter at brunone.com
Fri Mar 28 13:12:00 CDT 2008


Hi Tedd,

    It's a computer; you can do anything :)

    Seriously, though, if you have the IDs, then you just need to define your rules for parsing them (I assume you meant that #q33 would disappear after 3 seconds, rather than having #q31 disappear twice).  Take the last character of the ID -- or just replace the #q3 part if your sequence goes into the double digits -- and then call parseInt to convert it to an integer.  Use a function that recursively calls itself with setTimeout if there's another element left in the sequence, and you should be all set.

Does that make any sense?  I haven't slept much lately.

Peter

----------------------------------------

From: tedd tedd at sperling.com 

Hi:

I would like to remove DOM elements from a web page in a timed sequence.

These elements are identified with ID's in both html and a css sheet, 
such as those appearing at the end of this email. But, I would like 
to set these elements to "display: none;" in a timed sequence, such 
as #q31 disappears after one second, #q32 after two seconds, and #q31 
after three seconds.

Can that be done?

Thanks,

tedd

--- the css

#q31
{
position: relative;
top: 0px;
left: 40px;
}

#q32
{
position: relative;
top: 59px;
left: -64px;
}

#q33
{
position: relative;
top: 59px;
left: -64px;
}


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20080328/cf54e4b6/attachment.htm>


More information about the Javascript mailing list