JS Flashcards
1
Q
Where does Javascript go?
A
Like CSS, there are three options: 1. Inline – mixed in with the HTML tags 2. Internal – contained within tags 3. External – contained in a .js file that is linked to from the HTML page
2
Q
What are the different events that can trigger JS functions?
A
onclick – user clicked the element onchange – the element changed onmouseover – mouse hovers over the element onmouseout – mouse left the element onkeydown – user pressed a key onload – page finished loading
2
Q
is this an example of Inline JS?
<h1>
Main Title</h1>
A
Yes
3
Q
What are Event Handlers?
A
The JavaScript code that runs when the event happens is called an
event handler.
They also be used with browser events, e.g.
when the user refreshes the page
when the user exits a page
when the user clicks back
4
Q
What are the four ways of Generating Javascript output?
A
- Modifying the innerHTML propery of document objects
- Using the document.write() method to append HTML to the
current document - Using alert() to pop up a message box
- Using console.log() to write to the browser’s JavaScript console
5
Q
What would be the value of carName in this statement? var person = "John Doe", carName, price = 200;
A
Undefined