It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

roll over image help

roll over image help

Postby tracy01 on Sat Feb 28, 2009 3:26 pm

Hi I'm trying to get my program to switch images with the mouse roll over effect. Basically if it is wednesday i want the image of the calendar to lightup (i have a separate image for that) and if its not wednesday the image changes
Any suggestions?
tracy01
 
Posts: 1
Joined: Thu Feb 26, 2009 7:58 pm

Re: roll over image help

Postby rangana on Wed Mar 04, 2009 6:45 am

Code: Select all
<script type="text/javascript">
/**
Script Title: Show image by Date
Script Author: Raymond Angana as first seen on devppl.com/forum [username = rangana]
Date Created: 3/4/09
This notice must stay intact for legal use
*/
var ray = {
   imgIfNotMatch: 'images/notWednesday.jpg', // URL of image if it is not wednesday
   imgIfMatch: 'images/Wednesday.jpg', // URL of image if it is wednesday
   
   showImgByDate:function (el,d) {
      var date = new Date();
      this.getID(el).src = date.getDay()==d?this.imgIfMatch:this.imgIfNotMatch;
   },
   
   getID:function (el) {
      return document.getElementById(el);
   }
}
</script>
<img src="default.jpg" alt="something better than this text" id="myimage">
<script type="text/javascript">
ray.showImgByDate('myimage',3); // Pass the ID of the image and the date that you want to compare. 0 - Sunday, 1-monday, etc...
</script>
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines


Who is online

Users browsing this forum: No registered users and 6 guests