Web Hosting Directory | Web Hosting Resources | Webmaster Resources | Domain Tools | Search Engine Marketing | Forums
  Signup
Today: 826   Yesterday: 1,235   Max: 1,872   Total: 481,803   Current Users : 17 (Member 0) 
DOMAIN TOOLS

WEBMASTER TOOLS

RELATED ARTICLES

SUBMIT AN ARTICLE

Write for us and get publicity, link to your website, and best of all get paid. Please visit our writers page for details.


LINK TO US

Link to us and earn points for each visitor you bring to us. Please visit our link partner page for details.

 
Many Links, One Rollover Starflower
Allen
Jimmy
Paul
Miko
Each of these links changes the image when the mouse is over the link

Many Links, One Rollover: The <IMG ...> Tag

To set the image for doing many-link-one-image rollovers, we add one attribute to the <IMG ...> tag: NAME. After the tag we add a short script which loads the images used for the rollover. For example, this code configures the image for using five different images:

<IMG 
   SRC="imagedefault.gif"
   WIDTH=100 HEIGHT=100 ALT="Many Links, One Rollover"
   NAME="showperson"
   >
<SCRIPT TYPE="text/javascript">
<!--
setswap("showperson",
   'starflower', 'starflower2.gif',
   'allen',      'allen.gif',
   'jimmy',      'jimmy.gif',
   'paul',       'paul.gif',
   'miko',       'miko2.gif'
   );
//-->
</SCRIPT>

The first part of the tag is pretty normal: it sets the SRC, HEIGHT, WIDTH, and ALT attributes. The picture named in the SRC attribute is what will be displayed when the mouse is not over any link. After that we have a NAME attribute: NAME="showperson". The image must have a name so that we can refer to it in the link tags.

After the <IMG ...> tag we have a short script which loads the other images which are used in the rollover. The script has only one command, setswap(). The parameters for setswap() consist of a two-column list of images. Two pieces of information are passed for each image. In the first column is a nickname for the image. The second column has the source for the picture. This list can be as long as you like. Be sure that there is a comma after every nickname and after every source except for the last source in the list. Also, don't forget to put a closing paren after the list.

Now we create the links which trigger the rollover.



Copyright 1997-2002 Idocs, Inc. Written by Miko Sullivan.

 
 
 
What is your major source of website traffic?
 
 
 
 
 
 

ADVERTISEMENT

 
Cheap Web HostingBudget Web HostingEcommerce Web Hosting
Link to UsLink ExchangeAdvertisePrivacy PolicyTerms Of ServiceAbout UsContact UsSitemap
Copyright © 2006 - 2008 Broadband Media, Inc. All rights reserved.