update js to support multiple pages buttons