Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register
| FAQ | Members List | 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
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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.
Reply With Quote
  #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)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 07:52 AM.


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