Javascript - Difference between "window." and "document."?
Hi,
I'm a Javascript newbie that's just finished by first Captivate (CP9) screen (HTML5) using Javascript.
A slide with multiple text entry boxes (TEBs) and one Submit button, which runs a function to validate the TEBs (Thanks David for getting me started).
I call the function in the Submit button's script window and have the Javascript in the Index file.
In the Javascript i have used both "windows." and "document." (not sure if i have used them correctly but the Javascript works)
I don't really know the difference between them.
In Javascript I know that window is loaded into browser first, then document is loaded into window.
It’s like window is your browser's window and document is the HTML page inside it.
Also you can use each one to access specific properties - and window has a global context.
Here's examples from my javascript:
- window.cpAPIInterface.setVariableValue("q1_fback", ""); - clearing a feedback message (text caption with variable) associated with a TEB
- document.getElementById("Text_Entry_Box1_inputField").style.border = "medium solid red"; - changing the border of a TEB object to incorrect (red)
My question is:
1. What's the difference between "window." and "document." in a Captivate context?
I'll will be posting more questions to find out how to:
1. use loops to cut down my code
2. reuse the same function across other slides
Regards
Donal.
