|
|
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.
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 .
| |   |
|