PC Review


Reply
Thread Tools Rate Thread

How do I display the date/time on my frontpage web pages?

 
 
=?Utf-8?B?YmlnZ2lu?=
Guest
Posts: n/a
 
      24th Mar 2005
How do I display the date/time on my frontpage web pages?
 
Reply With Quote
 
 
 
 
Jens Peter Karlsen[FP MVP]
Guest
Posts: n/a
 
      24th Mar 2005
Why bother? generally people know what date/time it is or can look down
to the right on their screen or at their wristwatch if they desire to
know.
You can however use a javascript to do it.
A search on Google for, javascript date time, should give you plenty of
examples.


> -----Original Message-----
> From: biggin [private.php?do=newpm&u=]
> Posted At: 24. marts 2005 16:17
> Posted To: microsoft.public.frontpage.client
> Conversation: How do I display the date/time on my frontpage
> web pages?
> Subject: How do I display the date/time on my frontpage web pages?
>
>
> How do I display the date/time on my frontpage web pages?
>


 
Reply With Quote
 
Trevor L.
Guest
Posts: n/a
 
      25th Mar 2005
You could try this JS:

function getTheDate()
{
var now = new Date()

date =
["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
[now.getDay()] + ", "
+ ["January","February","March","April","May","June","July",
"August","September","October","November","December"]
[now.getMonth()] + " "
+ now.getDate() + " "
+ now.getFullYear()
return date
}
//------------------------------

function getTheTime()
{
function paddigits(number,digits)
{ var limit = (digits == 2) ? 10
: (digits == 4) ? 1000
: 1
return (number < limit) ? "0" + number : number }
//------------------------------

var now = new Date()
var hours = now.getHours()
var dn = (hours >= 12) ? "PM" : "AM"

hours = (hours == 0) ? 12
: (hours > 12) ? (hours - 12)
: hours

var minutes = paddigits(now.getMinutes(),'2')
var seconds = paddigits(now.getSeconds(),'2')

var time = hours + ":" + minutes + ":" + seconds + " " + dn
return time
}
//------------------------------

function DateTime()
{
var cdate = '<b>'
+ getTheDate() + " "
+ getTheTime() + "</b>"

if (browser.ie4 || browser.ie5)
{document.all.clock.innerHTML = cdate}
else
if (document.getElementById) // dom
document.getElementById("clock").innerHTML = cdate
else
document.write(cdate)
}
//------------------------------

function gettime()
{ setInterval("DateTime()",1000) }
//------------------------------

Place the above code, as is, in a text file e.g. external.js

Place this in the head section of your HTML:
<script type="text/javascript" src="scripts/external.js"></script>

Alter the body tag to:
<body onload = "gettime()">

In the place where you want the date and time place this:
Current Date: <span id="clock"></span>

This creates a time ticker, i.e. updated every second. The time will be on
bold like this
Current Date: Friday, March 25 2005 3:00:45 PM
--
Cheers,
Trevor L.
Website: http://tandcl.homemail.com.au


I choose Polesoft Lockspam to fight spam, and you?
http://www.polesoft.com/refer.html


 
Reply With Quote
 
Trevor L.
Guest
Posts: n/a
 
      25th Mar 2005
Sorry,

I noticed an error (or at least an oversight)

The code following
if (browser.ie4 || browser.ie5)
{document.all.clock.innerHTML = cdate}
else
if (document.getElementById) // dom
document.getElementById("clock").innerHTML = cdate
else
document.write(cdate)

depends on the existence of a function named browser.

This is it.
var browser = new Browser()
function Browser()
{this.dom = (document.getElementById) ? 1: 0
this.ie4 = (document.all && !this.dom) ? 1: 0
this.ns4 = (document.layers && !this.dom) ? 1: 0
this.ns6 = (this.dom && !document.all) ? 1: 0
this.ie5 = (this.dom && document.all) ? 1: 0
this.ok = (this.dom||this.ie4||this.ns4)
this.platform = navigator.platform

this.is_mac = (this.platform.indexOf("ac") != -1);
}
It should be placed at the top of the same js file (which in my example was
/scripts/external.js)
--
Cheers,
Trevor L.
Website: http://tandcl.homemail.com.au


I choose Polesoft Lockspam to fight spam, and you?
http://www.polesoft.com/refer.html


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
click date/time field display calendar and validation of date /tim Smithskenpo Microsoft Outlook Form Programming 0 4th Mar 2010 08:20 PM
Bound Date/Time field to automatically display the current date Billiam Microsoft Access Database Table Design 2 20th Sep 2009 11:13 PM
frontpage 2003 ASP pages display as code? Help? =?Utf-8?B?SWFuTQ==?= Microsoft Frontpage 5 17th Nov 2005 09:56 AM
DataGrid + Access-DB - display date-values grouped by date and time? Olaf Rabbachin Microsoft VB .NET 1 19th May 2005 09:23 AM
ASP pages that Display According to the Date Vaughn Microsoft Frontpage 2 3rd Sep 2003 09:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:39 PM.