![]() ![]() The easiest way to deal with lots of code is to place it into a function and call the function from the interval timer, as shown in the following code. However, for most situations more lines of code are needed. app.setInterval( "this.getField("clk").value = util.printd("HH:MM:ss",new Date() " ,50) In the simplest case, all we need to do is write a time value into a field. ![]() ![]() Every time the interval time expires the JavaScript is executed. The function, app.setInterval(), takes two inputs, some JavaScript (in a text string), and the size of the interval in milliseconds. Conveniently, Acrobat JavaScript provides a function for creating a continuous timer. The problem with making a clock is that you need a way to continuously update the field. From here, you can start a new form from scratch, or base it off of an existing PDF or document file that you already have. Click Tools on the upper right of the screen, scroll down, and select Prepare Form. The code for creating the clock is provided in the following discussion, but it will be helpful to open and examine the file before continuing.Ĭlocks and timers are just fields that display a time. To start, go into Acrobat, and create a form. For information on plug-in level scripts, see Working with JavaScript actions on page 60. While there are plug-in, document, and field level JavaScripts, we are concerned only with document level and field level scripts here. The stopwatch and timer are left as exercises for the reader. Script in Acrobat forms are forma tting data, calculating data, v alidating data, and assigning an action. We’ll cover the technique for creating the multi-zone clock. In it you’ll find a multi-zone clock, a stopwatch, and a count down timer. The example file for this section is JavaScriptClock.pdf. Part 3 of 3 Building Clocks and Timers with the Date Object ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |