- ELB Learning Knowledge Base
- Lectora®
- Programming
-
Lectora®
- Quick Win Tutorials
- Getting Started
- Modular Development (ModDev)
- Quick Guides
- Best Practices
- Navigating the Workplace
- Building a Title
- Importing Content
- Working With Text
- Working with Images
- Working With Objects
- Actions and Variables
- Tests, Surveys, and Questions
- Working with Web Windows or HTML Extensions
- Publishing a Title
- Creating Web-based, Accessible Content (Section 508/WCAG)
- Lectora Layouts
- Managing Titles
- Managing your Assignments
- Managing Your Notifications
- Communicating
- Admin Guide
- Lectora Player Skins
- Lectora Interactions and Scenarios
- Games
- Misc.
- Programming
- General
- Using Tracking for Progress, Status, etc
- Working with BranchTrack
- Trouble Shooting
- Working with Audio and Video
-
CenarioVR®
-
The Training Arcade®
- Arcades™
- Video Overviews
- FAQ's
- Recent Feature Videos
- Game Analytics
- Customer Feedback
- Demo Information
- General Admin
- Building Your Game
- Analytics
- Compatibility and Integrations
- Data, Security, and Privacy Policy
- JEOPARDY!®
- Jump
- Scenarios
- Trivia
- Trivia Virtual Instructor-Led Mode (VILT)
- Sort-It
- Scramble
- Recall
- Match
- Detective
- Translations
- New User Information
- Custom Branding Opportunities
- Registration and Leaderboard
- JEOPARDY!® Virtual Instructor-Led Mode (VILT)
-
MicroBuilder™
-
Asset Libraries
-
Rockstar Learning Platform
-
Rehearsal
-
Off-the-Shelf Training
-
ReviewLink®
-
The Learning Creation Studio
-
CourseMill®
-
General Topics
-
xAPI
-
Template Styles
-
Misc.
-
Articulate Storyline
-
Customizable Courseware
-
Course Starters
-
Camtasia
-
Group Administration
-
General
-
Can't find the answer? Ask our Customer Solutions team.
Containing your containers: Custom JavaScript Suggestions for Lectora Online
For custom JavaScript authors, it is important to not reference container elements directly. Especially with Publishing for Seamless Play, containers such as window and document can no longer be referenced directly. Instead you need to use the global methods below to properly access these containers.
getDisplayWindow() |
Returns the window objects that is to be used for dealing with the js objects generated by Lectora and all window related attributes. |
getDisplayDocument() |
Returns the document object that is to be used for dealing with the visual HTML objects, it contains all of the currently HTML elements for the page. |
getCurrentPageDiv() |
Returns an HTML element that represents the page div. |
getCurrentPageID() |
Returns a string with the name of the current page div. |
appendElement(obj, parentElement, htmlElement) |
This function can be used for attaching objects to the current page div; the customer would only need to pass in the last attribute as either a HTML element or a string. |
Let’s look at some examples for clarity.
Let’s say we have an HTML Extension of Type Custom Div
that looks like this
<p id="demo"></p>
And in our title we have a button with an action to run JavaScript to change our paragraph to the current date. The JavaScript looks like this
document.getElementById('demo').innerHTML = Date();
This works in non Seamless Play Publish; however, it will not work in Seamless Play Publish.
For Seamless Play Publish, you have to change the JavaScript so that it correctly finds the document:
getDisplayDocument().getElementById('demo').innerHTML = Date();
Here is an appendElement example. This simply adds a list item to the pageDiv:
appendElement(null,null,"<li>text<li>");
This article last reviewed Dec, 2015. The software may have changed since the last review. Please visit our Release Notes to learn more about version updates.