JavaScript - the difference between ' window ' and 'document.'?

Hello

I'm a Javascript newbie which ended just by the first screen of Captivate (CP9) (HTML5) using Javascript.

A slide with several text entry areas (TEBs) and a Submit button, which performs a function to validate the TEBs (thank you David for have started me).

I call the function in the script of the Submit button window and have Javascript code in the Index file.

In the Javascript code, I used the ' windows ' and 'document '. (don't know if I've used them correctly but the works of Javascript)

I don't really know the difference between them.

In Javascript, I know that window is loaded in the browser first, then the document is loaded in the window.

It's like the window is your browser window and the document is the HTML page inside.

Also, you can use each of them to access specific properties - and window has a context.

Some examples of my javascript:

  • window.cpAPIInterface.setVariableValue ("q1_fback", "");         -erase a message of feedback (text of legend with variable) associated with BER
  • document.getElementById("Text_Entry_Box1_inputField").style.border = 'solid red medium. "  -modification of the border of an object invalid BER (red)

My question is:

1. What is the difference between ' window ' and "document." in a context of Captivate?

I will post you more questions to find out how:

1 use loops to knock down my code

2 reuse the same function in other slides

Concerning

Donal.

Your assumptions are correct.

the cpAPIInterface is in the window.

The Text_Entry_Box1_inputField is in the document, not the window, but you can use:

window.document.getElementById("Text_Entry_Box1_inputField").style.border = 'solid red medium. "

Scope of variables depends on how and when they are declared, and it is generally best to limit their scope and not use them globally in the window object. All seem to be available in the cPs variables window.

Tags: Adobe Captivate

Similar Questions

Maybe you are looking for

  • No plugin unit after installation webplayer

    Hello I use Firefox x 64 on Windows 10 x 64 platform. There is no plugin unit after you have installed the web player. The activation of the preload plugins according to https://support.mozilla.org/en-US/kb/windows-media-or-other-plugins-stopped-work

  • The Apple apps installed has a download icon?

    Hello! I got a new iPad a few days ago that I restored from backup to iCloud. However, Apple apps like iMovie, Pages, Keynote etc displays a download icon in the App Store? Applications with this icon are already installed... Does anyone have an idea

  • Satellite 5105-607 battery issues

    Hi, I bought for my satellite 5105-S607 a refurbished battery. Unfortunately, this lasts more than 6 hours battery charge from 3% to 100%! Only, every morning when I start the PC after it was extinguished during the night, I found it has lost 8% of i

  • Need drivers after upgrading to Windows Vista Business on Satellite A100

    Hey I've upgraded to vista some time ago and my buttons of media and Fn keys no longer work. I don't know if there are drivers available, but if anyone knows where I can get would be great. The model number is PSAA8C-0FH00E

  • Bundle i386 VMware-Player 4.0.2

    Moved on:Linux 2.6.32 - 5-686 SMP #1 vascomp kills Jan 16 16:04:25 UTC 2012 i686 GNU/LinuxInstallation said that this computer does not support 64-bit and quit unexpectedlyFunny