2 Replies Latest reply on Mar 2, 2015 3:44 PM by im62245787

    How to create bookmarks with javascript?

    im62245787

      Hello!

       

      I have a question regarding the creation of boomarks with javascript.

      I'm using the following line to create bookmarks:

           this.bookmarkRoot.createChild(words[i], "pageNum=a");


      The problem is that the bookmarks are created but all lead to the same page.

       

      The full code:

       

      / Put script title here /

      var string2 = [];

      string2 = "word;example;test";

      var words = words.split(";");

      var N = words.length;

       

      for (i = 0; i < N; i++) {

          var pageArray = [];

          var string = words[i];

          for (var p = 0; p < this.numPages; p++) {

              for (var n = 0; n < this.getPageNumWords(p); n++) {

                  if (this.getPageNthWord(p, n) == words[i]) {

                      pageArray.push(p);

                      a = pageArray[0];

                      this.bookmarkRoot.createChild(words[i], "pageNum=a");

                      break;

                  }

              }

          }

      }

       

      Any help is much appreciated!