A JavaScript script that displays a default message in the browser status bar when a user loads a web page may be created.
Event handlers: JavaScript is an event-driven language.
JavaScript is an object-based scripting language.
Here is the syntax used to refer to a property:
object.property
Syntax used to call a method:
object.method([param1, param2, ..])
JavaScript provides a generous selection of built-in objects -- window, document, form, link, anchor, text, button, check box, and more -- along with their associated properties and methods. You can also create your own objects.
The window object is the top-level built-in JavaScript object. All other JavaScript objects are contained within the window object. It is a two-part expression:
window.defaultStatus
JavaScript scripts can be embedded or nonembedded. An embedded script is one that is located within an HTML tag. Example:
<BODY BGCOLOR="black" TEXT="white" onLoad="window.defaultStatus='Navigator Frame'">
A nonembedded script is one that is located between <SCRIPT LANGUAGE="JavaScript"> .. tags. Example:
<SCRIPT LANGUAGE="JavaScript">
Assignment -- Add the following to the body line of your web page:
var currDate = new Date()
var currDay =
currDate.getDate()
var currMonth = currDate.getMonth() + 1
var currYear = currDate.getYear()
currDateStr = currMonth + "/" + currDay + "/" + currYear
</SCRIPT>
Questions: (E-mail the answers to your teacher.)