Summary  Summary

Add to your favorites

Maps  Maps
Portal  Portal
Geomatic  Geomatic
Computers  Computers
Download  Download
Jobs  Jobs

Customize  Customize
Games  Games
Forums  Forums
GuestBook  GuestBook

CW GIS  CW GIS
GeoRezo  GeoRezo
Georama  Georama




3.139.67.228
Web design
Daniel FAIVRE©
|

JavaScript "Rollover"

  Français Français 
Introduction
Le JavaScript "Switch"
 Introduction    
    One of most used script is certainly the "rollover", e.g. the reaction of an image under the cursor. Many scripts do that: here is probably the simplest one. Furthermore, each object existence is tested. Even if an error occurs, the script should not bug neither display alerts. You can freely copy this source code for your site.
 Le JavaScript "Switch"
    Here's the source code to insert in the <BODY> section of your web page:
<SCRIPT LANGUAGE="JavaScript">
/* (c) 2001 freeware - no warranty - ie5 tested - http://www.geomaticien.com */
function Switch(obj)
   {
   if (obj)
      {
      if (obj.src)
         {
         img = obj.src;
         if (obj.name)
            {
            obj.src = obj.name;
            obj.name = img;
            }
         }
      }
   }
</SCRIPT>
   Now, just insert the Switch() function to make an image or a link reactives, like this:
<IMG SRC="image1.png" NAME="image2.png" BORDER=0 onmouseover="Switch(this);" onmouseout="Switch(this);">
   Ce qui donne: , , ou .