How to Jump to Specific PDF Form Pages Using JavaScript or Destinations
Question details
The user wants to configure form buttons in a PDF document to automatically navigate to specific pages, such as jumping from page one to page four.

- Product
- PDF Editor
- Device & OS
- not provided
- Scenario
- Building interactive PDF forms and setting up navigation buttons to jump between non-sequential pages.
- Observed behavior
- Requires a method to trigger a page jump action when a user clicks a form button, either through scripting or built-in destination tools.
Ensure your PDF editor supports form editing and action triggers. If you plan to use JavaScript, take note of the exact target page numbers.
Configure a Mouse Up JavaScript Action
Use a simple JavaScript command attached to a form button to jump to a specific page index.
PDF JavaScript uses zero-based page indexing. This means the first page is 0, the second page is 1, and so on. To jump to the fourth page, you will use index 3.
Right-click the form button you want to use for navigation and select 'Properties'.
Go to the 'Actions' tab, choose 'Mouse Up' as the trigger, and select 'Run a JavaScript' from the Action drop-down menu.
Click 'Add' and enter the code: `this.pageNum = 3;` (replace '3' with your target page index). Click 'OK' to save.

Create and Link to Named Destinations
Set up named destinations in your PDF to create stable navigation links that remain accurate even if pages are inserted or removed.
Create Interactive PDFs with WPS Office
WPS Office provides an intuitive PDF editor that lets you easily add hyperlinks, bookmarks, and page navigation tools without writing complex JavaScript.
- 1. Open Your PDF: Launch WPS Office and open your PDF document.
- 2. Insert a Link: Navigate to the 'Edit' tab and click on 'Link' to draw a clickable area on your document.
- 3. Set Link Action: In the pop-up properties window, select the option to jump to a specific page and enter your desired target page number.
- 4. Save Document: Click 'OK' and save your PDF. The clickable area will now navigate directly to the specified page.

Frequently Asked Questions
Why does my JavaScript jump command go to the wrong page?
PDF JavaScript uses zero-based indexing. If you want to jump to page 4, you must use `this.pageNum = 3;`. Using `4` will incorrectly take you to page 5.
Do named destinations break if I add pages to my PDF?
No, one of the main advantages of using named destinations is that they remain intact and point to the correct location even if pages are added or deleted before the destination.
Can I navigate to a different PDF document entirely using form buttons?
Yes, in the button properties under the Actions tab, you can select 'Open a file' or 'Go to a page view in another document' to navigate to external PDFs.




