/[drupal]/contributions/sandbox/deekayen/modules/dpistudy/dpistudy.js
ViewVC logotype

Contents of /contributions/sandbox/deekayen/modules/dpistudy/dpistudy.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Mon Jan 28 20:45:40 2008 UTC (21 months, 4 weeks ago) by deekayen
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/javascript
rename dissertation module to dpistudy, upgrade from Drupal 5.x to 6.x, and initial commit of dissertation theme
1 var timerID = null;
2 var timerRunning = false;
3 var startDate;
4 var startSecs;
5
6 function stopclock() {
7 if(timerRunning) {
8 clearTimeout(timerID);
9 }
10 timerRunning = false;
11 }
12
13 function startclock() {
14 if(timerRunning == false) {
15 startDate = new Date();
16 startSecs = (startDate.getHours()*60*60) + (startDate.getMinutes()*60) + startDate.getSeconds();
17 }
18
19 stopclock();
20 showtime();
21 }
22
23 function showtime() {
24 var now = new Date();
25 var nowSecs = (now.getHours()*60*60) + (now.getMinutes()*60) + now.getSeconds();
26 var elapsedSecs = nowSecs - startSecs;;
27
28 var hours = Math.floor( elapsedSecs / 3600 );
29 elapsedSecs = elapsedSecs - (hours*3600);
30
31 var minutes = Math.floor( elapsedSecs / 60 );
32 elapsedSecs = elapsedSecs - (minutes*60);
33
34 var seconds = elapsedSecs;
35
36 var timeValue = "" + hours;
37 timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
38 timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
39
40 document.dpistudy.js_timer.value = timeValue;
41 timerID = setTimeout("showtime()",1000);
42 timerRunning = true;
43 }
44
45 function dpistudy_q5(center) {
46 stopclock();
47 document.dpistudy.instruct_q5.value = center;
48 document.dpistudy.submit();
49 }

  ViewVC Help
Powered by ViewVC 1.1.2