My vForum




 

My vForum :: Customization :: Coding :: Submissions :: View Topic - Image Rollover
Printable View
Danny
Offline

*****
Official Coder
Reputation: 0%
Joined: 27th May 2008
Age: 17
Gender: Male
Durham
Image Rollover (5th Jun 08 at 4:33pm)
Code that allows you to make in image change once hovered over.
Global Header

Code:Select All
  1. <script type="text/javascript">
  2. <!--
  3. /*Image Rollover by Danny*/
  4.  
  5.    function rollOver(oldImg,newImg,newTitle){
  6.      getImg = document.getElementsByTagName('img');
  7.        for (a=0; a<getImg.length; a++){
  8.         if(getImg[a].src.match(new RegExp(oldImg))){
  9.      title = getImg[a].alt;
  10.          getImg[a].onmouseover = function(){
  11.              this.src = newImg;
  12.              this.alt = newTitle;};
  13.          getImg[a].onmouseout = function(){
  14.              this.src = oldImg;
  15.              this.alt = title;};
  16.            }
  17.       }
  18.   }
  19.  
  20. rollOver('Old Img','New Img','New Title');
  21.  
  22. //-->
  23. </script>
Back to Top - Link to Post
Printable View

All times are GMT+0 :: The current time is 3:26am
Page generated in 0.3257 seconds
with 14 Database Queries and 3 cache files
This Forum is Powered By vForums
Create a Forum for Free