View Full Version : Scripting


Yuppy
06-22-2003, 05:10 AM
Hm...I'm trying to make a script that will change an image through a sequence of events (1, 2, 3, 4, 5, etc. and to end at 10) and not having it be random. I'm also trying to make it so that the images would change during a certain time of day, daily. So far I've a script that changes the text on a page during the different times of day:

<script language="Javascript">

<!--
// please keep these lines on when you copy the source
// made by: Nicolas - http://www.javascript-page.com

day = new Date()
hr = day.getHours()
hr1 = hr - 12

if (hr < "6") {
document.write("Go back to bed!! "+hr+" AM is too early!")
}

else if (hr < "12") {
document.write("Good morning. It's "+hr+" AM.")
}

else if (hr < "13") {
document.write("Lunch time! It's "+hr+" M")
}

else if (hr < "17") {
document.write("Good Afternoon. It's "+hr1+" PM")
}

else if (hr < "22") {
document.write("Good Evening. It's "+hr1+" PM")
}

else if (hr > "21") {
document.write("Good night. It's "+hr1+" PM, Go to sleep.")
}

//-->

</script>

although I've been trying to figure out how to make it detect an image as well in the 'if' part of the statement without much luck. If anyone can offer a suggestion for my problem, please feel free to post! Thanks!

designhazard
06-22-2003, 11:25 AM
what do you mean by: make it detect an image as well in the 'if' part of the statement ?

Yuppy
06-22-2003, 04:08 PM
well...something like if its ___ time and there's ____image, then it would change the image to a different one.......^_^;; i'm sorry...I wish there was a better way for me to explain it....