Day = NoImage. Night = YesImage. . . Possible?

  • willstein
  • Loser
  • Loser
  • No Avatar
  • Joined: Oct 29, 2003
  • Posts: 117
  • Loc: Maryland
  • Status: Offline

Post November 8th, 2003, 9:40 am

Hey,

I need to find a way, to make certain code appear at night, and the code dissappear in the day.

In other words.
picture.jpg only appears on my website at night time.

any suggestions?
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post November 8th, 2003, 9:40 am

  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: May 28, 2003
  • Posts: 23407
  • Loc: Woodbridge VA
  • Status: Offline

Post November 8th, 2003, 9:53 am

You'll need to use javascript time/date functions. This isn't precisely the code you would use, but this demonstrates how the function retrieves time and date from the viewer's internal clock.

Code: [ Select ]
<b>Todays Date: </b><SCRIPT LANGUAGE="JavaScript">
<!--
Stamp = new Date();
document.write('' + (Stamp.getMonth() + 1) +"/"+Stamp.getDate()+ "/"+Stamp.getYear() + ' <br> ');
var Hours;
var Mins;
var Time;
Hours = Stamp.getHours();
if (Hours >= 12) {
Time = " P.M.";
}
else {
Time = " A.M.";
}

if (Hours > 12) {
Hours -= 12;
}

if (Hours == 0) {
Hours = 12;
}

Mins = Stamp.getMinutes();

if (Mins < 10) {
Mins = "0" + Mins;
}

document.write('<B>Todays Time:</b> ' + Hours + ":" + Mins + Time + '');

//-->
</SCRIPT>
  1. <b>Todays Date: </b><SCRIPT LANGUAGE="JavaScript">
  2. <!--
  3. Stamp = new Date();
  4. document.write('' + (Stamp.getMonth() + 1) +"/"+Stamp.getDate()+ "/"+Stamp.getYear() + ' <br> ');
  5. var Hours;
  6. var Mins;
  7. var Time;
  8. Hours = Stamp.getHours();
  9. if (Hours >= 12) {
  10. Time = " P.M.";
  11. }
  12. else {
  13. Time = " A.M.";
  14. }
  15. if (Hours > 12) {
  16. Hours -= 12;
  17. }
  18. if (Hours == 0) {
  19. Hours = 12;
  20. }
  21. Mins = Stamp.getMinutes();
  22. if (Mins < 10) {
  23. Mins = "0" + Mins;
  24. }
  25. document.write('<B>Todays Time:</b> ' + Hours + ":" + Mins + Time + '');
  26. //-->
  27. </SCRIPT>


You would have to alter it, by adding functions to test for the start and stop times you want your image displayed. I'm sure this would work, but I have to step out for most of the day and don't have the time to sit down and write it all out. That should at least get you started in the right direction.
"There's no place like 127.0.0.1 except for ::1."
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.
  • willstein
  • Loser
  • Loser
  • No Avatar
  • Joined: Oct 29, 2003
  • Posts: 117
  • Loc: Maryland
  • Status: Offline

Post November 8th, 2003, 9:55 am

alright, that might work, but what if the image itself is javascript?


would I still be able to input it?
  • rjstephens
  • Professor
  • Professor
  • User avatar
  • Joined: Jul 28, 2003
  • Posts: 774
  • Loc: Brisbane, Australia
  • Status: Offline

Post November 17th, 2003, 6:39 am

all that code does (i think) is spit out the date and time. Nothing more, nothing less. You would need to do some sever modification.

I personally woud do it using PHP, for several reasons, not the least of which is that it stops websmart visitors from using the View Source command and bypassing you protection. If you have access to PHP, i'll look into it for you.
  • willstein
  • Loser
  • Loser
  • No Avatar
  • Joined: Oct 29, 2003
  • Posts: 117
  • Loc: Maryland
  • Status: Offline

Post November 17th, 2003, 7:42 am

thanks for the offer but i got it down.
yeah i used php.

check out -REMOVED- from 1-5 EST and yuu'll see a mess of banner ads.
catchya later.
  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Joined: Jun 15, 2003
  • Posts: 4583
  • Loc: Maryland
  • Status: Offline

Post November 17th, 2003, 1:18 pm

wasn't this post somewhere else?

yes I thought so this was just a cross post of http://www.ozzu.com/viewtopic.php?t=18873&start=0
Pixel Acres V2
  • UNFLUX
  • Genius
  • Genius
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 6382
  • Loc: twitter.com/unflux
  • Status: Offline

Post November 18th, 2003, 9:03 pm

:roll: tired of this
UNFLUX.FOTO

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 99 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.