Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old December 30th, 2005, 04:00 AM
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.
  #2 (permalink)  
Old January 9th, 2006, 04:10 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Are you sure you parentheses after the method calls?
e.g. do you have:
Code:
var h=today.getHours()
or
Code:
var h=today.getHours
--

Joe (Microsoft MVP - XML)


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error running Javascript in IE 6 Swati Chari Javascript 4 July 7th, 2008 01:08 AM
how to purge javascript error padam Javascript 1 July 30th, 2007 02:13 AM
Firefox javascript error akkad Ajax 2 November 27th, 2006 10:57 AM
Javascript Syntax Error Ben Horne Javascript 2 April 5th, 2004 09:38 AM
Error Handling in JavaScript Raul Javascript How-To 4 January 23rd, 2004 07:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.