HTML Goodies: Script Tip: Week 4
Let's get into part four, the last part of the discussion of this basic image flip script:
<IMG SRC="menu1off.gif" BORDER=0 NAME="pic1"></a>
You know what it does, you have seen the hierarchy statement explained, and you know what the onMouseOver and onMouseOut Event Handlers do. Now we answer the question from the last Tip:
First off, the image really isn't an item apart from the Event Handlers. This entire script is in the format of an HREF link using an image as the item to be clicked upon. So, the IMG command is part of the whole. Still, how does the script know to change out that image and no other? The answer lies in the hierarchy statement:
We know that the "document" is this page. At the other end of the statement, we know that "src" means source. It's that thing in the middle, "pic1", that represents the IMG command. How, you ask? Well, let's have a look at the IMG command:
See the attribute, NAME="pic1"? Ta da! That's it. We named the image "pic1." Then we called for the hierarchy statement to affect something called pic1.
That's how they're linked.
That wraps up this script. Put it on your page and enjoy it.
Do YOU have a Script Tip you'd like to share? How about suggesting a Script Tip to write about? I'd love to hear it. Write me at: email@example.com.
HTML Goodies 30-Step Primer Series
and take the knowledge home with you in
on your Web pages here!