codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:



Javascript Multiple Rollovers From One Link



Getting multiple images to rollover from a single link is a lot easier than you might think. You start with a standard rollover link such as this:

<a href="http://www.codetoad.com" onMouseOver=image1name.src="images/button1b.gif"    
onMouseOut=image1name.src="images/button1a.gif"> 
<img src="button1a.gif" name ="image1name" border=0></a> 


We've named then image 'image1name' and set it's source to 'images/button1a.gif'. When the user rolls over the onMouseOver event is called, which changes the source to 'images/button1b.gif'.

When the user moves the mouse away from the image, the onMouseOut event is called and the source is set back to the original 'images/button1a.gif' (of course, there's no requirement to go back to the original, it could just as well go to a totally different image).

Now, to affect two images at once, we simply add another onMouseOver and onMouseOut action within the tag, as follows:

<a href="http://www.codetoad.com" onMouseOver=imagename.src="images/button1b.gif"   
onMouseOver=image2name.src="images/button2b.gif"   
onMouseOut=imagename.src="images/button1a.gif"   
onMouseOut=image2name.src="images/button2a.gif">
<img src="button1a.gif" name ="image1name" border=0></a>
<img src="button2a.gif" name ="image2name" border=0>


Now rolling over the first image will change both images at the same time - simple!










Recent Forum Threads
• Re: store string from text file to vector
• Re: c# .net Exception of type System.StackOverflowException was thrown.
• Re: error: expression must have a constant value
• Re: Script Does Folder Exist – If Not Create It
• $_GET not working
• GET METHOD
• Re: windows service - web service - com
• Re: Storing data from HTML to Excel or TXT
• Re: Help totalReads=1 totalReads++=2 write totalReads 3 not 2


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2010