null - using a variable to navigate pages in an Acrobat document -
I am trying to navigate users through an Acrobat document using the buttons. If they click one of the navigation buttons, then everything works fine when they do, then I
pgnum = this.pageNum Set a variable, then I send them to the requested page. When they press the Return button, I use the following
this.pageNum = pgnum problem occurs if they scroll (any button Click) page and hit return I can actually send them back to the first page of the document (page 0). In this scenario, pgnum is undefined or something else I tried following without luck.
if (pgnum == num) {this.pageNum = 1; // has also tried it. PageNum.value = 1} and this. PageNum = pgnum I'm sure this is a syntax problem or an issue with dealing with undefined variables.
What can you do to prevent undefined? Define Pgnum as the document-level variable.
Create a document-level script, in which only this line is:
var pgnum = 0; Then you can simplify the code in the back button:
this.pageNum = pgnum; The documents will go to the page number as determined by pgnum. If this has not been changed, then it will go to the first page of the document.
The disadvantage is that after going to a set pgnum, it always goes back to that page, until a new pgnum value is set. There may be a better idea to reset Pgnum as soon as it is used to return to a selected page:
this.pageNum = pgnum; Pgnum = 0; and should do that.
Comments
Post a Comment