0 Replies Latest reply on Jun 7, 2011 8:58 PM by JoeTse_BL

    Execute Javascript problem

    JoeTse_BL

      I am using Captivate 5, and I have a problem executing javascript when entering a slide.

       

      I'm creating a flash for users to do some questions, and they will get a score. In the last slide, the score is display and I want to pass it to the webpage through javascript.
      So in that slide, I set the action like this

       

      ---------
      On Enter: Execute Javascript

       

      Script_Window:
      var objCP = document.Captivate;
      var totalScore;
      totalScore = objCP.cpEIGetValue('TotalScore');
      window.parent.markbook.UpdateScore(totalScore);

       

      - selected Current
      - checked Continue Playing the Project
      ---------
      On Exit: Continue

       

      ---------
      The above javascript execute just fine. But interestingly, I found if the javascript execute successfully, the page is blank with the number 0 on it. And the last slide will not display.
      and in the URL field of the browser, it showed:
      javascript:var objCP = document.Captivate;var totalScore;totalScore = objCP.cpEIGetValue('TotalScore');markbook.UpdateScore(totalScore);

       

      But if the javascript has error (e.g. I add a "continue;" statement at the bottom) or I put an alert statement at last, it can continue to display the slide that I want.

       

      Does anyone know how can I set the javascript to run successfully then continue to display the slide? Or it is a bug in captivate that cannot execute javascript successfully?

       

      Many thanks for the help.

       

      Joe