Zhichu Chen wrote: > Hello everybody, > > I want to add a clock which shows the system time to a pdf file. > And I have read the ``art-calc.pdf'' and ``mwidget-p.pdf'' to find > some approaches but failed shamely. I am indeed new at ConTeXt and > JavaScript. Before I'm shocked by ConTeXt, I used LaTeX for about 2 > years, so I'm confused with the conventions between ConTeXt and LaTeX. > My code is here: > I don't have the time right now for more than this short tip. If you work with JavaScript you should open the JaveScript Debugger (CTRL-J in Acrobat; in the Adobe Reader hit CTRL-K and check "Show console on errors and messages" in the JavaScript categorie) to see the warnings and error messages. You also should insert some log messages in your code. For example
console.println("do_digit("+d+") at page "+[this.pageNum]); at the start of your function do_digit. This helps a lot to see what is going on. Greetings, Peter > ---------------------------------------------------------------------------------- > \setupinteraction[state=start] > > \startJSpreamble functions used now > function do_digit(d) > { Stack[Level] += String(d); > do_refresh(Level) } > \stopJSpreamble > > \startJScode{digit} > do_digit(JS_S_1); > \stopJScode > > \definefield[Stack.1][line][Results][][ > > \setupfield > [Results] > [horizontal,frame] > [width=fit, > height=2cm, > frame=on] > [height=18pt,width=80pt,align=middle,frame=off] > [height=18pt,width=80pt,color=red,align=right,style=type,frame=off] > > \setupbuttons [background=infobutton] > > \starttext > > Click \button{7}[JS(digit{7})] will get > \field[Stack.1] > > \stoptext > -------------------------------------------------------------------------------- > > I only copied these codes from "art-calc.pdf" so there must be some > other critical concepts that I haven't realized. Please point them to > me. Thanks > _______________________________________________ > ntg-context mailing list > ntg-context@ntg.nl > http://www.ntg.nl/mailman/listinfo/ntg-context > > _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context