JavaScript W3 - Scope & Events

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Here are some examples of HTML events:

-An HTML web page has finished loading -An HTML input field was changed -An HTML button was clicked

Many different methods can be used to let JavaScript work with events:

-HTML event attributes can execute -JavaScript code directly -HTML event attributes can call JavaScript functions -You can assign your own event handler functions to HTML elements -You can prevent events from being sent or being handled

Event handlers can be used to handle, and verify, user input, user actions, and browser actions:

-Things that should be done every time a page loads -Things that should be done when the page is closed -Action that should be performed when a user clicks a button -Content that should be verified when a user inputs data

onchange

An HTML element has been changed

HTML events

Are "things" that happen to HTML elements

Local variables

Are created when a function starts, and deleted when the function is completed

The global scope is the:

Complete JavaScript environment

Local variables are deleted when the function is:

Completed

The lifetime of a JavaScript variable starts when it is:

Declared

Objects and ____________ are also variables

Functions

A variable declared outside a function, becomes

GLOBAL *A global variable has global scope: All scripts and functions on a web page can access it.

If you assign a value to a variable that has not been declared, it will automatically become a:

Global Variable

Variables declared within a JavaScript function, become ___________ to the function

LOCAL Local variables have local scope: They can only be accessed within the function.

In JavaScript there are two types of scope:

Local scope Global scope

_________ determines the accessibility (visibility) of these variables

Scope

onload

The browser has finished loading the page

onclick

The user clicks an HTML element

onmouseout

The user moves the mouse away from an HTML element

onmouseover

The user moves the mouse over an HTML element

onkeydown

The user pushes a keyboard key


Kaugnay na mga set ng pag-aaral

Darwin's Theory Bio 2 answer keys

View Set

The Modernist Period (1910-1945)

View Set

Philosophy Chapter 4: Myself or Others?

View Set