Anish Khan

Anish Khan

  • NA
  • 25
  • 0

Display digital clock on asp.net page

Sep 18 2009 2:22 AM


Hi Friends,
I want to display digital clock on my asp.net master page.
I am using thi code..
<
script language="javascript" type="text/javascript">
function startTime() {
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();
// add a zero in front of numbers<10
m = checkTime(m);
s = checkTime(s);

document.getElementById(
'txtt').value = h + ":" + m + ":" + s;
t = setTimeout(
'startTime()', 500);
}
function checkTime(i) {
if (i < 10) {
i =
"0" + i;
}
return i;
}
</script>
Note:- txtt is a textbox id.
And it is printing an error like:- Microsoft JScript runtime error: 'document.getElementById(...)' is null or not an object
Please send me the code for this..
Thanks
Anish