View Single Post
  #1 (permalink)  
Old December 30th, 2005, 04:00 AM
whiterainbow whiterainbow is offline
Authorized User
 
Join Date: Dec 2004
Location: Madurai, Tamil Nadu, India.
Posts: 69
Thanks: 0
Thanked 5 Times in 5 Posts
Send a message via Yahoo to whiterainbow
Default JavaScript Error

Hi,

I'm using the javascript to display the clock in my asp.net page. The script is given below:

<script 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('dtime').innerHTML=h+":"+m +":"+s
t=setTimeout('startTime()',500)
}

function checkTime(i)
{
if (i<10)
  {i="0" + i}
  return i
}
</script>

I am calling the function on the body load event and providing the element to the table dimension (<td id="dtime">).

And I tried the element as div also(<div id="dtime">) but it is giving the nativecode writeups over there means the following is displayed in the div or td

function getHours() { [native code] } : function getMinutes() { [native code] } : function getSeconds() { [native code] }

And I tried to convert it into text and write over there still it is not displaying the clock. If anybody knows how to eliminate the native code write ups

Tnx n Regards

Thanks and Regards,

Senthil Kumar M.

senthilkumar.mohan@gmail.com
http://www.leanlearn.tk
__________________
Thanks in advance.

Regards,

Senthil Kumar M.