GotoPage()

Example 1:

This line of script will go to the page in your publication called Main Menu.

GotoPage("Main Menu")

Example 2:

This line of script will go to the page in your publicationcalled Subject2 Review.

var pageName = "Subject2 Review"
GotoPage(pageName)

Example 3:

The following piece of script uses the If…else conditional script (further details) to check to see whether the user’s score is above a passmark (70%).

If it is the script sets the pageName variable to the pass page (entitled Passed) and if not it sets the pageName variable to a page encouraging review of the material (entitled Subject2 Review).

The GotoPage script is then used to move to the appropriate page for the current situation (pass or review).

Note that the pageName Variable is emptied at the start of the script to ensure it doesn’t already contain something else. Whilst this isn’t strictly necessary in this case because we are giving it a whole new value within our function it is a good habit to get into. Not resetting a variable before you use it again can have unpredictable results and can be difficult to debug because your code looks (and is) correct but is being fed an incorrect variable.

 

var pageName = ""

if(SCORE_PERCENT >= 70)

{

pageName="Passed"

}

else

{

pageName="Subject2 Review"

}

GotoPage(pageName)

Close