Forums
 This topic is locked 
             real time clock
 Posted 14 Feb 2003  01:23:15 
  1 
     has   voted 
  14 Feb 2003  01:23:15 KanKava KanKava posted: 
 how can i make happear a real time clock that show me the seconds increase. tnx
Replies
 Replied 14 Feb 2003  01:59:53 
   14 Feb 2003  01:59:53 asp asp replied: 
  use this it will put your clock in the bottom left in the status window.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><title>Clock</title>
<head>><script language="JavaScript">
function doClock() {
window.setTimeout( "doClock()", 1000 );
today = new Date();
self.status = today.toString();
}
</script>
</HEAD>
<BODY BACKGROUND="back1.gif" OnLoad="doClock()" LINK="#0000FF"
VLINK="#800090" ALINK="#FF0000">
This is a clock.
</body>
</html>
 
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><title>Clock</title>
<head>><script language="JavaScript">
function doClock() {
window.setTimeout( "doClock()", 1000 );
today = new Date();
self.status = today.toString();
}
</script>
</HEAD>
<BODY BACKGROUND="back1.gif" OnLoad="doClock()" LINK="#0000FF"
VLINK="#800090" ALINK="#FF0000">
This is a clock.
</body>
</html>
 Replied 14 Feb 2003  11:46:46 
   14 Feb 2003  11:46:46 KanKava KanKava replied: 
  tnx
but dont you have a code in VBScript?
 
  but dont you have a code in VBScript?
 Replied 14 Feb 2003  13:33:40 
   14 Feb 2003  13:33:40 asp asp replied: 
  This clock works in VB... 
   Replied 14 Feb 2003  16:57:29 
   14 Feb 2003  16:57:29 KanKava KanKava replied: 
  it works fine .. but i wanted only the time clock in a cell inside the page. 
   Replied 15 Feb 2003  18:46:58 
   15 Feb 2003  18:46:58 asp asp replied: 
  ok!  try this it wont be in the status bar now.
<HTML>
<HEAD>
<TITLE>
Untitled
</TITLE>
</ce>
<BODY>
<div align="center">
<font face="Arial, Helvetica, Sans Serif" size="1" color="#000000"><b><span id="clock">
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December"
function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
{
d = new Date();
Time24H = new Date();
Time24H.setTime(d.getTime() + (d.getTimezoneOffset()*60000) + 3600000);
InternetTime = Math.round((Time24H.getHours()*60+Time24H.getMinutes()) / 1.44);
if (InternetTime < 10) InternetTime = '00'+InternetTime;
else if (InternetTime < 100) InternetTime = '0'+InternetTime;
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
var cdate=dayarray[day]+", "+montharray[month]+" "+daym+" "+year+" | "+hours+":"+minutes+":"+seconds+" "+dn+" "
if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock" .innerHTML=cdate
.innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate()
function goforit(){
if (document.all||document.getElementById)
setInterval("getthedate()",1000)
}
window.onload=goforit
// End -->
</script>
</span></b></font>
</div>
</html>
 
  <HTML>
<HEAD>
<TITLE>
Untitled
</TITLE>
</ce>
<BODY>
<div align="center">
<font face="Arial, Helvetica, Sans Serif" size="1" color="#000000"><b><span id="clock">
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"

var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December"

function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
{
d = new Date();
Time24H = new Date();
Time24H.setTime(d.getTime() + (d.getTimezoneOffset()*60000) + 3600000);
InternetTime = Math.round((Time24H.getHours()*60+Time24H.getMinutes()) / 1.44);
if (InternetTime < 10) InternetTime = '00'+InternetTime;
else if (InternetTime < 100) InternetTime = '0'+InternetTime;
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
var cdate=dayarray[day]+", "+montharray[month]+" "+daym+" "+year+" | "+hours+":"+minutes+":"+seconds+" "+dn+" "
if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock"
 .innerHTML=cdate
.innerHTML=cdateelse
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate()
function goforit(){
if (document.all||document.getElementById)
setInterval("getthedate()",1000)
}
window.onload=goforit
// End -->
</script>
</span></b></font>
</div>
</html>