DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   JavaScript / DHTML / AJAX (http://www.daniweb.com/forums/forum117.html)
-   -   Timer Problem in Javascript (http://www.daniweb.com/forums/thread88382.html)

BalagurunathanS Sep 3rd, 2007 6:56 am
Timer Problem in Javascript
 
Hi Friends.
I am using javascript to display timer in my .aspx page..I also use javascript to do validations in that page.when i alert the user with a message.i.e when alert function is called,the timer stops and becomes idle.Again when i click the ok button of the message box that occured as a result of alert function ,the timer starts ticking again from where it had left earlier..Time deviation occurs due to this..How to solve it? Someone help in this regard as early as possible..


Thanks & Regards,

Balaguru

~s.o.s~ Sep 3rd, 2007 1:51 pm
Re: Timer Problem in Javascript
 
AFAIK, alert() being a blocking function will bring all the processing to a grinding halt. So, to keep the timer running when the alert() is pending for an user action seems to be a pretty difficult task.

One way you can get around this is to display an error message in a custom dialog box (made of div) or display the error message in a span instead of doing an alert.

But as I always say, client side validation is completely at the mercy of the client and is a moot point. Server side validation is the way to go.

BalagurunathanS Sep 4th, 2007 2:19 am
Re: Timer Problem in Javascript
 
Hi ..

I have no idea with that custom message box.How to do it..?
Kindly provide me with some sample script if u have..

Regards,
Balagurunathan S

~s.o.s~ Sep 4th, 2007 12:54 pm
Re: Timer Problem in Javascript
 
For displaying a custom dialog box, you need to use an external javascript library like YUI, Prototype.js, Mootools etc. Here is a simple example using the YUI javascript library.


All times are GMT -4. The time now is 1:36 am.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC