Drop-down Display

In the last Script tip, we learned the layer and its properties. Now let's get it to display.

provided by: 
Originally published at Internet.com


Wrapping it all up...

OK, we've got the basics. We know about the layer, we understand the loops, now let's put it all together in a function. Yes, I know there are two functions, but look again. They are exactly the same function except for one keystroke. For use with Netscape Navigator.

The Script's Effects

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

Here's the code

We know that the entire layer is on the page; we've just made a point of hiding part of it. The function showmenu() reveals the rest of the layer, but rather than just popping it up, it produces a scroll. It's a nice effect that requires the use of two "for" loops. Since "for" loops are new to the script tips, let's look at how they work. function showmenu() { startx = document.layers["click"].clip.bottom for (j=0;j<70;j++) { document.layers["click"].clip.bottom = startx+j for (x=0;x<120;x++) { void(0) }}}

Rather than simply starting with line one and bulling forward, allow me to give you the overall big picture. Two things are happening in this function. A portion of the layer is being revealed. Then a span of time is allowed to pass, then another piece is revealed, then a span of time is allowed to pass, etc., etc...

Read article at Internet.com site
Regional Articles

Rss   Delicious   Digg   Add To My Yahoo   Add To My Google   Bookmark   Search Plugin

Topics:
Architecture & Design Languages & Tools Project Management Web Services
Database Microsoft & .NET Security Wireless
Java Open Source Techniques XML