Reply
Wed 29 Sep, 2004 02:29 pm
Where can I find tutorials and source (code or wysiwyg) to insert current date, time, and weather onto my home page
Depends what webserver your pages are on for date and time (also whether you want to state the date/time for your server or for the user using your server)
For server time on an IIS server in an ASP page you could just stick this in the body somewhere:
<%= Date() & " " & Time() %>
For client machine time I'd use javascript. This is a bit of code I wrote that says good morning, good afternoon or go home depending on the time:
<script language = 'JavaScript'><!--
//Figuring out what greeting to use by checking time on local PC
var date = new Date();
var hours = date.getHours();
if ( (hours < 8) || (hours > 17) )
{ document.write('Go home');}
else if ( (hours >7) && (hours < 12) )
{ document.write('Good morning');}
else if ( (hours >11) && (hours < 18) )
{ document.write('Good afternoon');}
//-->
You could get rid of the logic stuff and just use document.write to display 'date' and 'hours'
Javascript date and time has a lot of copy/paste date and time scripts.
Weather is not something that can be determined by simple scripts, so you'd need to get weather information from somewhere.
Here are some leads:
http://search.able2know.com/Web_Development/Content/Weather/index.html