Date & Time Effects >>> Time and Date.
 
Script Categories













Date & Time >>> Time and Date.

This will show an updating clock and date in a small box.

TimeHourMinSec

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!--  Hide JavaScript from Java-Impaired Browsers
var isn1=null;
var isn2=false;
today=new Date();

function stopit(){
if(isn2){
  clearTimeout(isn1);
  }
isn2 = false;
}

function startit(){
stopit();
isnclock();
}

function isnclock(){
var now=new Date();
var hrs=now.getHours();
var min=now.getMinutes();
var sec=now.getSeconds();
document.clckh.disp.value=""+((hrs>12) ? hrs-12 : hrs);
document.clckm.disp.value=((min<10) ? "0" : "")+min;
document.clcks.disp.value=((sec<10) ? "0" : "")+sec;
document.clck.disp.value=(hrs>=12) ? "p.m." : "a.m.";
isn1=setTimeout("isnclock()",1000);
isn2=true;
}
// Build an array initializer
function isnArray() {
argnr=isnArray.arguments.length
for (var i=0;i<argnr;i++) {
  this[i+1] = isnArray.arguments[i];
  }
}
// And months and day arrays
var isnMonths=new isnArray("January","February","March","April","May","June","July","August","September","October","November","December");
var isnDays= new isnArray("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday");
//-->
</script>
<TABLE BORDER=2>
<TR>
<TD>
Time</TD><TD>Hour</TD><TD>Min</TD><TD>Sec</TD><TD></TD>
</TR>
<TR>
<TD></TD>
<TD
VALIGN=TOP><FORM NAME="clckh" onSubmit="0">
<INPUT
TYPE="text" NAME="disp" SIZE=2 VALUE ="">
</FORM>
</TD>
<TD
VALIGN=TOP><FORM NAME="clckm" onSubmit="0">
<INPUT
TYPE="text" NAME="disp" SIZE=2 VALUE ="">
</FORM>
</TD>
<TD
VALIGN=TOP><FORM NAME="clcks" onSubmit="0">
<INPUT
TYPE="text" NAME="disp" SIZE=2 VALUE ="">
</FORM>
</TD>
<TD
VALIGN=TOP><FORM NAME="clck" onSubmit="0">
<INPUT
TYPE="text" NAME="disp" SIZE=4 VALUE ="">
</FORM>
</TD></TR>
<script language="javascript" type="text/javascript">
<!--Hide JavaScript from Java-Impaired Browsers
document.write("<TR><TD><B>Date</B></TD><TD COLSPAN=4>"
+isnDays[today.getDay()]+", "+isnMonths[today.getMonth()+1]
+
" "+today.getDate()+", "+today.getFullYear());
window.onload=startit;
// Finish hiding of script -->
</script></TD>
</TR>
</TABLE>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).




©