質問
Help with Acrobat Javascript Shared Functions
This is not clear in the Javascript document, but where can I put shared functions which are used by my scripts?
Below I have 3 functions. X() and Z() which should both happen on the blur of a text field.
Function Y() is a calculation which both X() and Z() need to use.
Y is available for X(), but not for Z() without pasting its code twice.
Where do shared functions go?
//-------------------------------------------------------------
//-----------------Do not edit the XML tags--------------------
//-------------------------------------------------------------
//<AcroForm>
//<ACRO_source>CN1:Annot1:OnBlur:Action1</ACRO_source>
//<ACRO_script>
/*********** belongs to: AcroForm:CN1:Annot1:OnBlur:Action1 ***********/
function X()
{
int x = 0;
//do something
int y = Y(); //Works here
return x;
}
function Y()
{
int y = 1;
//do something
return Y;
}
//</ACRO_script>
//</AcroForm>
//<AcroForm>
//<ACRO_source>CN2:Annot1:OnBlur:Action1</ACRO_source>
//<ACRO_script>
/*********** belongs to: AcroForm:CN2:Annot1:OnBlur:Action1 ***********/
function Z()
{
int Z = 2;
//do something
int y = Y(); //Function Y is out of scope/unavailable here
return Z;
}
//</ACRO_script>
//</AcroForm>
