[Javascript] Timed demo doesn't work as expected, why?

tedd tedd at sperling.com
Sun Mar 30 12:07:32 CDT 2008


Hi gang:

Here's a demo of the problem I'm having:

http://www.webbytedd.com/cc/timed-toggle/

The trigger code is:

<input type="checkbox" onclick="toggleDiv('hide1'); 
toggleDiv('hide2'); toggleDiv('hide3'); ">Toggle this

My thought was that when someone un-clicks "Toggle this" box, that 
the sequence should be:

1. Wait one second and set DOM "hide1" to "display: none;" and hide 
that DOM segment.

2. Wait one second and set DOM "hide2" to "display: none;" and hide 
that DOM segment.

3. Wait one second and set DOM "hide3" to "display: none;" and hide 
that DOM segment.

However, what it does is wait for three seconds and then hides everything.

Why does it do that?

And knowing what I'm trying to do, how can I make it work as I want?

Thanks,

tedd

-- 
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com



More information about the Javascript mailing list