insert date and time

C

Claudia Adames W.

Hi, I'm trying to insert the actual date and time in to my site but I really
don't like the one provided by the Microsoft Frontpage help, because it has a
border and a white backgroud. Where can I find one just with the text and no
backgroung or borders and much better in spanish if possible? Thank you for
your help. Claudia
 
M

Mark Fitzpatrick

If you're looking for the current date and time as opposed to the date/time
the page was created/edited, your best bet is javascript. Luckily there are
lots of free scripts out there, some of them are very tailorable.

Check javascript.internet.com and www.dynamicdrive.com for really good
date/time and clock scripts.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
 
T

Trevor L.

Claudia,

Here is a simple script that displays the (local) date and time every second
function DateTime()
{
var now = new Date()
var cdate = '<b class="red">'
+ now.toLocaleDateString() + ' '
+ now.toLocaleTimeString()
+ '</b>'
if (document.all)
document.all.clock.innerHTML = cdate
else
if (document.getElementById)
document.getElementById("clock").innerHTML = cdate
else
document.write(cdate)
}
function gettime()
{ setInterval("DateTime()",1000) }
//------------------------------

In your HTML,
change <body> tag to <body onload="gettime()">
and where you want the time to display , add
Current Date: <span id="clock"></span>

or you may wish to make it
Fecha Actual: <span id="clock"></span>

Other things you can do is
remove class="red" if you don't want the date and time in red
remove + now.toLocaleDateString() + ' ' if you want only the time and not
the date
 
Top