Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rotating header

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
anyone know a way to rotate a header image accodring to the time of day - I want to set up a morning/afternoon/night motif - ideas?
 
Well basically set up an if/else sequence, querying the client machines time - then set the image you need.

<script>
//get the current hour from client machine
var hour = new Date().getHours();

if((hour >=0) && (hour<12)){
// Morning stuff
}
else if((hour >=12) && (hour <17)){
// Afternoon stuff
}
else{
// do evening stuff
}

</script>


So you could break it up as much as you like - early afternon etc Then you need a function called onLoad which decides which image to display - then sets the src of the appropraite <img /> object. ;-)
b2 - benbiddington@surf4nix.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top