vForums Support > Programming & Coding :: Database of Codes/Hacks/Mods :: > Simple Image Rollover Code

Simple Image Rollover Code - Posted By Michael (wrighty) on 15th Mar 08 at 10:31pm
This will allow you to give any image a rollover. Even if it's a sig image! {Shocked}

Simply add more of:
roll_over('normal_image','rollover_image');
normal_image = the image to show normally
rollover_image = image to be shown when you mouseover the image.


Code:
Code:
 
  1. <script type="text/javascript">
  2. /*Rollover for buttons
  3. By Wrighty
  4. wRcreations & vFSupport*/
  5.  
  6. function roll_over(old, over){
  7.    var img = document.getElementsByTagName("img");
  8.    for(i=0; i<img.length; i++){
  9.       if(img[i].src.match(old)){
  10.          img[i].onmouseover = function(){this.src = over;};
  11.          img[i].onmouseout=function(){this.src = old;};
  12.       }
  13.    }
  14. }
  15.  
  16. roll_over('normal_image','rollover_image');
  17. </script>
 


Global Footer