Toronto Escorts

Any Web Coding Geniuses?

BBW_Morgan

Banned
Sep 11, 2001
132
0
0
Toronto
www.independentescorts.ca
Help!

Desperately looking for the code that will allow me to have a page display different graphics depending on what time of day the person loading it does so at.

I'm not talking about random image display applets here - I *know* that there is code which allows me to create a different page layout based on the timezone during which the page is loaded. ie: one set of same sized/placed graphics for day, one for night.

I suspect this is a DHTML issue, as opposed to Java, but can't find the protocol anywhere. I don't want to run it via PERL, so if I can't do it via DHTML or java I'll have to scrap this design layout.

Anyone have any ideas?

Morgan
 
A

Average Joe

Morgan,

I'm not a web coding genius but here is a page that uses Javascript to display banner1.gif in the morning, banner2.gif in the afternoon and banner3.gif in the evening. If you want to display more images, such as every hour, just change the getImageIndex function.

Sorry about the spacing. The "code" tag doesn't seem to be working properly.

Code:
<html>
<head>
<script>
<!--
function getImageIndex() {
   hour = (new Date()).getHours();
   if (hour < 12)
      return 1;
   else if (hour < 18)
      return 2;
   else
      return 3;
};
-->
</script>
</head>
<body>
<script language="JavaScript">
<!--
document.write('<img src="banner' + getImageIndex() + '.gif">');
-->
</script>
</body>
</html>
 

BBW_Morgan

Banned
Sep 11, 2001
132
0
0
Toronto
www.independentescorts.ca
Alrighty, that just might do it...

I wonder if it will let me refer to more than one image... of course, I'm probably just being picky.

Sigh.

I think I need to take a java refresher course...soon.

Morgan
 
Last edited:
A

Average Joe

I wonder if it will let me refer to more than one image...
Do you mean that you want to change a group of images depending on the time of day. If so, then you can still use the same function. Just copy the image tag and change the prefix of the file name from "banner" to something else.


I think I need to take a java refresher course...soon.
Not meaning to be picky but Javascript is NOT Java. Javascript has a similar syntax to Java but they are two totally different languages. Just one of my pet peeves. Okay, I guess I am being picky. :)
 

BBW_Morgan

Banned
Sep 11, 2001
132
0
0
Toronto
www.independentescorts.ca
Hee hee. That's why I looove geeks - so charmingly nitpicky. I mean that in a good way :)

Anyway, I'm going to cheat and use this one - it simply lets me design two seperate pages, each of which loads based on whether it is pre or apres 5 PM. Ta da! Of course, it would be nicer if it wasn't written in what looks like Finnish...

M.

<html><head>
<script language=javascript>
<!--var tijdID = null;var tijdLoopt = false;function stop_clock ()
{if(tijdLoopt)
clearTimeout(tijdID) tijdloopt = false;
}function show_time ()
{
var now= new Date();
var uren = now.getHours();
var huidigeTijd = uren;
document.form.clock.value = huidigeTijd;
tijdID = setTimeout("show_time()",1000);
tijdLoopt = true;
}

function start_clock ()
{
stop_clock();
show_time();
}
// -->
</script></head>
<body onload="start_clock()">
<form name="form"><input type="hidden" name="clock"size=10></form>
<script language=javascript>

if (document.form.clock.value < 17)
{
document.write ('<meta http-equiv=Refresh content=1;url="whatever18.htm">');
}
else
{
document.write ('<meta http-equiv=Refresh content=1;url="whatever.htm">');
}
</script>
<center><font face=system>LOADING</font></center>
</body></html>
 
Last edited:
A

Average Joe

Well, it just shows you that there's more than one way to skin a cat. Actually, 961 by my last count. :D

I would warn you that unless this page is loaded into a frame it will be possible for people to accidentally bookmark the page you redirect to. In that case they could bookmark in the evening. If they use their bookmark to go back the next morning they will still end up with the evening web page.
 

BBW_Morgan

Banned
Sep 11, 2001
132
0
0
Toronto
www.independentescorts.ca
Well, in that case, it's their loss for missing all of my kewl page design... ;)

I could prolly get around it with an .asp file, but who wants to go there?

Morgan
 

Sir Lancelot

New member
Sep 2, 2001
33
0
0
BBW_Morgan said:
I could prolly get around it with an .asp file, but who wants to go there?

Morgan

.asp?????? Bite your tongue Morgan!! Doesn't Mr Gates have enough money already -LOL You should try .jsp pages instead of asp. Unlike asp, there's tons of freeware and open souce support for jsp. (Of course, then you might end up needing that java review course :) )

Java: In a world without fences, there's no need for gates.
 
A

Average Joe

Sir Lancelot said:
Java: In a world without fences, there's no need for gates.
Nice shot Lancelot.

Among other things, I am a Java developer so I always appreciate a good Bill Gates dig.
 

BBW_Morgan

Banned
Sep 11, 2001
132
0
0
Toronto
www.independentescorts.ca
Should I mention here that I solved this issue with a simple redirect java script program about a month ago?

And, after all this, the client decided not to go with this option after all. *sigh*

But don't stop the Gates jokes - I hate FrontPage almost more than Corel Draw...

Morgan
 
Toronto Escorts