JavaScript

JavaScript is a programming language that is often used to create interactivity on Web pages. Interactivity on Web pages is created using a combination of an event and an action. JavaScript is used to create behaviors, which are combinations of an event and an action. For example, revealing a new image in response to users passing the mouse point over a displayed image. Expression Web generates the JavaScript code to create 12 behaviors, which are described below.

Behavior Purpose
Call Script Inserts JavaScript without having to switch to Code view
Change Property/Change Property Restore Changes the characteristics of an object
Check Browser Checks to see if visitors have a particular browser installed
Check Plug-in Checks to see if visitors have the necessary plug-in
Go to URL Associates a form object with a link
Jump Menu/Jump Menu Go Creates a list of links within a list box
Open Browser Window Opens a new browser window in the same or different window
Play Sound Plays a background sound when the pointer hovers over a portion of the page
Popup Message Displays a popup message in the browser
Preload Images Loads images before the page itself loads
Set Text Creates a marquee
Swap Image/Swap Image Restore Replaces one image with another when the mouse pointer hovers over an image

BE CAREFUL! Don't annoy your visitors with background music! Use the Play Sound behavior with great discretion!

An event triggers an action to take place. Examples of events are a mouse click, mouse pointer movement, or the depression or release of a key on the keyboard. When we create a behavior, Expression Web also chooses the event that triggers the behavior. Here is a list of common events.

Event Action Occurs When
onclick An object is clicked
ondblclick An object is double clicked
onmousedown The left mouse button is pressed
onmouseup The left mouse button is released
onmouseover The mouse pointer rolls over an object
onmouseout The mouse pointer rolls off an object
onfocus An object receives keyboard attention
onblur An object loses keyboard attention
onload The page loads
onunload The browser closes or a different page is loaded
onselect Text is selected
onresize A window or frame is resized

Links are often created in a navigation bar (aka: nav bar). A nav bar is a list of links in a row near the top of the page.