Javascript Home, Intro, Where To, and Output
JavaScript Can Change HTML Styles (CSS)
Changing the style of an HTML element, is a variant of changing an HTML attribute
JavaScript Can Hide HTML Elements
Hiding HTML elements can be done by changing the display style
External scripts are practical when the same code is used in many different web pages.
[ ]
JavaScript accepts both double and single quotes: document.getElementById('demo').innerHTML = 'Hello JavaScript'; OR document.getElementById("demo").innerHTML = "Hello JavaScript";
[ ]
JavaScript files have the file extension .js.
[ ]
Placing scripts at the bottom of the <body> element improves the display speed, because script interpretation slows down the display.
[ ]
To add several script files to one page - use several script tags
[ ]
You can place any number of scripts in an HTML document. Scripts can be placed in the <body>, or in the <head> section of an HTML page, or in both.
[ ]
(T/F) JavaScript Can Change HTML Content
true
JavaScript Can Show HTML Elements
Showing hidden HTML elements can also be done by changing the display style
Create a variable called carName and assign the value Volvo to it.
var carName= "Volvo";
A JavaScript function is a block of JavaScript code, that can be executed when "called" for. For example, a function can be called when an event occurs, like when the user clicks a button.
[ ]
External JavaScript Scripts can also be placed in external files Example: myScript.js
[ ]
JavaScript is one of the 3 languages all web developers must learn: 1. HTML to define the content of web pages 2. CSS to specify the layout of web pages 3. JavaScript to program the behavior of web pages
[ ]
Placing scripts in external files has some advantages: It separates HTML and code It makes HTML and JavaScript easier to read and maintain Cached JavaScript files can speed up page loads
[ ]
JavaScript Can Change HTML Attribute Values
true
document.getElementById("demo").innerHTML = "Hello JavaScript";
"finds" an HTML element (with id="demo"), and changes the element content (innerHTML) to "Hello JavaScript"