vForums Support > Programming & Coding :: Database of Codes/Hacks/Mods :: > Adv. Image Rollover

Adv. Image Rollover - Posted By Michael (wrighty) on 15th Mar 08 at 10:26pm
This will allow you to add a rollover to ANY images. To get this to work, you have to name your images:

x_on and x_off. This is because the code will automatically change the '_on' to '_off' and vice-versa.

<script type="text/javascript">
/*Rollover for buttons
By Wrighty
wRcreations & vFSupport*/


for(i=0;i<get('img','tag').length;i++){
    if(get('img','tag')[i].src.match(/_off.(gif|png|jpg)/)){
        get('img','tag')[i].onmouseover = function(){this.src = this.src.replace(/_off/,'_on');};
        get('img','tag')[i].onmouseout=function(){this.src = this.src.replace(/_on/,'_off');};
    }
}
</script>


Global Footer