Hi there,
I've got 3 images that I want to show at different times of the day.
I've used a standard Javascript If else statement e.g.:
<script type="text/javascript">
var d = new Date()
var time = d.getHours()
if (time<12)
{
document.write("Morning")
}
else if (time>12 && time<17)
{
document.write("Afternoon")
}
else
{
document.write("Evening")
}
</script>
... and this code works. I've put this where the image(s) need to be displayed. What I want to do is replace the "document.write" bit with a standard <IMG> (or equivalent) where it'll just put the image in, just so a different image will be displayed
I've tried all sorts of different variations with no luck. I'm new to Javascript, so you'll probably think i'm dumb. Any ideas?



Reply With Quote




Bookmarks