HTML Goodies: Script Tip: Week 4
Let's get into part four, the last part of the discussion of this basic image flip script:
|
<A HREF="http://www.cnn.com" onMouseOver="document.pic1.src='menu1on.gif'" onMouseOut="document.pic1.src='menu1off.gif'"> <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.
Next Week: A New Script! Do I Really Need That LANGUAGE="javascript"?
|
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: jburns@htmlgoodies.com. |
HTML Goodies 30-Step Primer Series
and take the knowledge home with you in
JavaScript Goodies!
on your Web pages here!






Loading Comments...