Explore the community Forums Lectora Lectora Questions & Answers Are Javascript functions in Lectora global?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #311434 Score: 0
    Profile photo of Andrew Lian
    Andrew Lian
    Member
    beginner
    intermediate
    friend finder
    advanced
    contributor
    wise owl
    curious george
    profile
    12 pts
    @mlapl1

    In other words, can I declare a javascript function in the first page of my title and then call it from a different page?

    Thanks for any thoughts

    Andrew

    #311439 Score: 1
    Profile photo of Peter Jackson
    Peter Jackson
    Member
    beginner
    intermediate
    advanced
    friend finder
    contributor
    junior moderator
    wise owl
    group mod
    entry
    winner
    17 pts
    @pjackson2462

    G’day Andrew,

    JavaScript functions are global for the given page that is loaded.  If you declare the function at the page level then it will only be available for that give page, if declared at the chapter level then every page that shares that chapter will have access to the function and the best place if it’s going to be a common function is to put it at the title level from where it will be available on every page.

    HTH

    Regards, Peter

    http://www.LectoraDevelper.com

    This post has received 1 vote up.
    • This reply was modified 4 years, 6 months ago by Profile photo of Peter Jackson Peter Jackson.
    #311441 Score: 0
    Profile photo of Andrew Lian
    Andrew Lian
    Member
    beginner
    intermediate
    friend finder
    advanced
    contributor
    wise owl
    curious george
    profile
    12 pts
    @mlapl1

    Thanks Peter – I get it.

    cheers

    Andrew

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.