Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
1.67/5 (3 votes)
See more:
hi i am mohan,

I have a doubt please help me ....

Now i am creating website for Quiz competition

Quiz running randomly with time limit ok.

my quiz stored in sql server database.(accessing ado.net)

and at a TIME Time is Displaying That Web page(top right corner)

after finishing Time Limit Automatically Result will be dispalyed
or
finished my questions result will be displayed.

My Question is,
how to decreasing my TIME at answer the questions Process
Like that my time decreasing(10,9,8,... minutes to ...,4,3,2,1,0 seconds)

I am Waiting Ur Replay by mohan....
Posted

There are a huge number of JavaScript timers available, like this one, http://www.w3schools.com/js/js_timing.asp[^]. Have you searched for any or tried anything yourself?
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 17-Apr-11 16:26pm    
Right, my 5. I thing server-side is better, see my Answer.
--SA
This is ASP.NET. You can also measure time on server side using System.DataTime.Now. It you subtract two instances of System.DateTime you receive time span between the time stamps. The accuracy should be good enough for a quiz. I think server-side timing is better: no way to cheat, handy when you calculate the results.

—SA
 
Share this answer
 
Comments
[no name] 17-Apr-11 18:23pm    
I'm afraid this is not a "better" answer.

Please elaborate on how this will prevent cheating since values will need to be posted to and from client? How would you maintain the starting time so it could be compared when a postback occurred? How would the postback even be initiated without a trigger from the client?

The OP appeared to need a count down timer. How would this be accomplished on the server-side?
Sergey Alexandrovich Kryukov 17-Apr-11 21:04pm    
And is it your vote of 1, I wonder (it's OK it this is your opinion, don't worry)?
Now, you don't need to account the postback time, but the time for post surely limit accuracy in case it fluctuates. The student press next, on post one time stamp is saved, the enters a solution -- another time stamp, both time stamps are measured in the server's time. Duration and the answer go to system, the student cannot fake the timer, because it is not local. If the timing data and answer go from the client with timing data pre-calculated on the client side, I would pretty easily fake it by sending the post programmatically.
That's all. Care to think about it?
--SA
[no name] 17-Apr-11 22:10pm    
I was not talking about accounting for the postback time. Do you consider me an novice?

The OP wanted a simple countdown timer. Now with your solution you need to persist the original time in some fashion then compare it with the second postback time, keeping scalability and performance in mind of course as well. You are trying to create a complicated solution to a simple problem. Your solution also relies on the user to initiate a postback to get the timing. With a timed test, as this appears to be, the quiz should move on regardless of user interaction.

I believe you need to think a little more. Remember the KISS principle.

You are beginning to come off as arrogant and a know it all. Perhaps not your intention, but certainly the perception given.
Sergey Alexandrovich Kryukov 18-Apr-11 22:30pm    
Please see my next comment.
(And comment from Espens shows he agrees with me as well.)
--SA
Sergey Alexandrovich Kryukov 17-Apr-11 23:07pm    
No, I don't understand why such impression, sorry. I did not give you any reasons for personal assessments. How can such thing emerge from a pure technical discussion? Maybe I need to think a little more, what's wrong about it? Tried to support my variant. I don't see anything too complex.
How come post back time can question you knowledge? Just the opposite; I admit the time accuracy is less, because the timing on server is shifted by the time the answer is moved to the server. In next post this time is approximately the same but its fluctuation limit accuracy.
Here is the thing: I don't understand "initiate postback". Maybe we consider the different scenario? I picture the following: page with a question is shown as a result of post ("First question/Next question"), the student reads and type in the answer, click "Post Answer/Next" -- another post. You have two posts anyway, so I do not add any extra post "just for timing". Do you mean something different?
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900