[NTG-context] Acrobat JavaScript in ConTeXt

Hans Hagen pragma at wxs.nl
Tue Mar 8 00:29:13 CET 2011


On 7-3-2011 5:11, Vedran Miletić wrote:
> Hi,
>
> how can one make a button that does app.alert() in ConTeXt? I tried
> something like this without much luck:
>
> \setupinteraction[state=start]
>
> \starttext
> \goto{Button}[JS(app.alert{Hello World})]
> \stoptext
>
> Can anyone help?

\startJSpreamble MyStuff used later

function MyAlert(str) {
   app.alert(str)
}

\stopJSpreamble

\goto{Button}[JS(MyAlert{Hello World})]

so, we have a separation between definitions and usage.

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list