User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 426,635 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,575 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting

Difficulty with forms

Join Date: Jun 2006
Location: India
Posts: 6,858
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 23
Solved Threads: 344
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Lazy, Useless & Apathetic

Re: Difficulty with forms

  #3  
Nov 23rd, 2007
A lot of problems to begin with.

» You are accessing form elements the wrong way. Read this.

» prompt() returns a string and you are treating it as a number which in itself is introducing a lot of problems.

» setTimeout() takes it's second parameter as milliseconds and not seconds.

» I see a lot of needless calculations going on in showTime() function. Don't touch the DOM unless absolutely necessary. For eg. since we know that the value of the 'hour' text field would only change after 60 minutes, there is no point in updating it every second.

» In javascript, numbers are represented using 64 bit double precision format as per the IEEE floating point standards. Showing the amount of 'seconds' left in decimals would be not desirable. Use the toFixed() function of Number to get away with those extra digits after the dot.

Follow the suggestions, format and indent the code and come up with a fresh solution.
I don't accept change. I don't deserve to live.

Happiness corrupts people.

Failing to value the lives of others cheapens your own.
Reply With Quote  
All times are GMT -4. The time now is 12:46 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC