Callbacks for events on webpages
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
body { font-family: Helvetica, Arial, sans-serif; font-size: 12px; } h1 { font-size: 1.5em; } h2 { font-size: 1.2em; } |
In the example the interactive text size buttons can change the font-size
property of the body
element, and the adjustments will be picked up by other elements on the page thanks to the relative units.
The javascript to do this is shown here
...
- within a lexical environment, a value assigned to a variable that s not prefixed with var is globally available, so it pollutes the global namespace
- within a lexical environment, a value assigned to a var variable is not globally available
- within a lexical environment, a function that is assigned to variable (with or without var) is not available outside of the lexical environment unless it is returned using the return keyword, such a function is private