Section 1

Preview this deck

HTML Objects (getElementById)

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 14, 2020

Cards (29)

Section 1

(29 cards)

HTML Objects (getElementById)

Front

-used in a function to affect an element in the page with that specific ID

Back

Compound Conditional Statements

Front

If, else if, else conditionals -executes in order, and only the first true statement executes

Back

Dynamically Changing Individual CSS Properties

Front

.style function toggle_hide(which) { var myblock = document.getElementById('block1'); if ( which == 'show' ) { myblock.style.visibility = "visible"; } else { myblock.style.visibility = "hidden"; } } <a href="#null" onmouseover="toggle_hide('hide')" onmouseout="toggle_hide('show')">Block</a>

Back

Types of Errors

Front

- fatal: syntax error, script won't execute - logical: wrong solution to problem (2*2=6); script executes but wrong - user: bad input (ie non-number)

Back

Data Types

Front

strings, numbers, special

Back

Prompt Windows

Front

Pop-up windows at load time (or upon action) to either collect info, force acknowledgment, or make a decision -always returns a string

Back

General Event Handlers

Front

-listener set in place for an event to occur and then react to -onclick, ondblclick, oncontextmenu, onmouseover, onmouseout

Back

Variables

Front

a named storage location in the computer's RAM to store data to be retrieved later

Back

Variable Assignment Operator

Front

= - = represents 'is/becomes' here rather than equality -evaluate the expression on the right and store in the left

Back

Built-in Browser Objects

Front

-properties: define state of object; group of variables -methods: group of function; provide behaviors of object -browser objects: window, screen, location, history, navigator, document

Back

Browser Error Console

Front

Detects fatal errors -view > Developer > JS Console -cmd+opt+j

Back

DHTML

Front

using JS to manipulate HTML -term released by MS during browser wars to kill NN

Back

AND vs OR Table

Front

A(t) && B(t): t A(t) && B(f): f A(f) && B(t): f A(f) && B(f): f A(T) || B(T): T A(T) || B(F): T A(F) || B(T): T A(F) || B(T): F A(T): !A = F A(F): !A = T

Back

Comparison Operators

Front

>, <, >=, <=, ==, !=

Back

JS Functions

Front

like a prompt window, but can be called at anytime (depending on the action done) -built in: prompt, confirm, alert, parseFloat, Math.round, document.write

Back

Global Variables

Front

- keep track of the state of the page - defined outside of the function - if defined inside a function it is a local variable

Back

while Loop

Front

A control flow statement that allows code to be executed repeatedly -used to ensure the user inputs desirable data

Back

Dynamically Changing Element Content

Front

.innerHTML function toggle(which) { var block = document.getElementById('block1'); if (which == 'in') { block.innerHTML ='hello';} else { block.innerHTML = 'goodbye';} } <a href="#null" onmouseover="toggle('in')" onmouseout="toggle('out')">Block</a>

Back

Infinite Loops

Front

a while loops that executes infinitely and won't let the page load

Back

Validating User Input with JS

Front

-use while loops the prevent user from entering certain info

Back

Loop Counters

Front

A while loop that counts how many times the loop runs

Back

Dialog Windows

Front

- prompt: returns a string or null if you hit cancel; collects data -confirm: returns Boolean; requires decision - Alert: doesn't return value; requires acknowledgment

Back

Logical Operators

Front

&&: and ||: or !: not

Back

string concatenation

Front

Combining several strings into a single string, or combining a string with other data into a new, longer string (ie 'cat' + 'dog' = 'catdog')

Back

Boolean Data Type

Front

either true or false

Back

Conditional Statements

Front

If () is true then the next line is executed Else if () is the same as if () but only executes if else if() is true and if() is false else executes if if () and else if () are false

Back

Rules for Variable Names

Front

-only letters, numbers, and underscores -must begin with letter -must not be JS reserved word (ie var, document, write, prompt, etc)

Back

Dynamically Changing Style Class

Front

.className function toggle(which) { var block = document.getElementById('block1'); if (which == 'in') { block.className ="skin2";} else { block.className = "skin1";} } <a href="#null" onmouseover="toggle('in')" onmouseout="toggle('out')">Block</a>

Back

Document Object Model (DOM)

Front

Used by JavaScript to organize objects and page elements

Back