|
||
| Inside Technique : Introduction : The Second Example Let's go over a more complicated sample. This context menu item will fade out whatever image was clicked on, or fade up all images that are hidden. While less useful than the last example, it demonstrates the "event" object and transition filters, and is almost fun to use.
First comes the registry information in the registry file, called
"img_hide.reg":
Notice that this context menu is actually listed twice; one version called "Hide Image" is for images only, and another called "Show Hidden Images" shows in the default and link menus. There are two good reasons for this. This first is a design issue: how is a person who has just hidden a picture supposed to get it back? The image is no longer selectable, and forcing people to hit the "Refresh" button is a bad idea. The obvious answer is to include a second menu for the default context menu, which brings back every hidden image. This entry is also on the link menu because many images are used within links, and it's only natural to click where the image was. The second reason is educational. You should have noticed from the registry file that both menus use the same script file. That means the script has to determine the context it's being called in, then act appropriately. This is much more interesting than using two files.
The script file, called "img_hide.htm" and located in
"C:\WINDOWS\WEB", is as follows:
Now to examine this script one part at a time. Page 1:Introduction © 1997-2000 InsideDHTML.com, LLC. All rights reserved. |