0% found this document useful (0 votes)
60 views

Javascript Clock

This document demonstrates how to create clocks and timers in a PDF using JavaScript. It uses the date object and app.setInterval() function to create timers that execute code at regular intervals. The timer code is in a Document Script called "ClockCode" and buttons are used to control the timers by setting state variables. The timer must be cleared using app.clearInterval() before closing the document. It includes examples of a continuous clock, stopwatch, count down timer, and controls for setting time values.

Uploaded by

Nene
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Javascript Clock

This document demonstrates how to create clocks and timers in a PDF using JavaScript. It uses the date object and app.setInterval() function to create timers that execute code at regular intervals. The timer code is in a Document Script called "ClockCode" and buttons are used to control the timers by setting state variables. The timer must be cleared using app.clearInterval() before closing the document. It includes examples of a continuous clock, stopwatch, count down timer, and controls for setting time values.

Uploaded by

Nene
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

http://www.pdfscripting.

com

JavaScript Clock/Timer Demo


by Thom Parker
Stop Timer

WindJack Solutions, Inc.

We can make clocks and timers in a PDF by combining the date object with a timer. Timers are created in Acrobat JavaScript with the app.setInterval() function. As arguments this function takes the length of the timing interval in milliseconds and some JavaScript code to execute. In this file, the timer code is in a Document Script named ClockCode. The Timer control buttons below set state variables used in the timer function to control the internal time calculations and the display. The timer must be cleared before the document is closed. This is done with the app.clearInterval() function in the WillClose Action. Continuous Clock:

4:57:56 pm
Sunday Aug 17, 2008

24 hour

Local UTC

Portland New York

Hyderabad Tokyo

Stopwatch:

Stopped

00:00:00:00

Start

Stop

Pause

Clear

Count Down Timer:

00:00:00:00
+1 -1

Start

Stop

Clear

Set Hours:

+10

-10

Set Minutes:

+10

-10

+1

-1

Set Seconds:

+10

-10

+1

-1

Copyright 2006 by Windjack Solutions, Inc.

www.windjack.com

You might also like