Javascript Question

1. Member
Join Date
Sep 2008
Posts
74

## Javascript Question

I am trying to make it so an email address changes every 5 hours on my web page. I currently have four email addresses that will be displayed. I can do it for the first day but I am looking for a way so the emails are not the same hours for each day. I think I need to find how many hours have gone by since a certain point in time and then do some equation from there. Not sure how to get those numbers. Any help would be appreciated.<BR><BR>Thanks<BR><BR>Chris

2. Senior Member
Join Date
Dec 1969
Posts
1,846

## Here's a quick example in vbscript

This just compares the current time to midnight and then shows a different email depending on the hours from midnight. You trying to do this in javascript ? or jscript? <BR><BR>&#060;% Dim IntTimeFromMidnight<BR><BR> IntTimeFromMidnight = DateDiff("h", "12:00 AM", Time())<BR><BR> If IntTimeFromMidnight &#062; 0 and IntTimeFromMidnight &#060;= 5 Then <BR><BR> Response.Write "email@email.com"<BR><BR> ElseIf IntTimeFromMidnight &#062; 5 and IntTimeFromMidnight &#060;= 10 Then <BR><BR> Response.Write "email2@email.com"<BR><BR> ElseIf IntTimeFromMidnight &#062; 10 and IntTimeFromMidnight &#060;= 15 Then <BR><BR> Response.Write "email3@email.com"<BR><BR> ElseIf IntTimeFromMidnight &#062; 15 and IntTimeFromMidnight &#060; = 19 Then <BR><BR> Response.Write "email4@email.com"<BR><BR> ElseIf IntTimeFromMidnight &#062; 19 Then <BR><BR> Response.Write "email5@email.com"<BR><BR> End If %&#062;

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•