HTML and CSS Reference
As shown in Table 9-3, the general form of writing an object with its method is
similar to writing objects and properties.
require an argument. In
fact, with some methods,
if an argument is used, it
generates an error.
Table 9-3 Object and Method
where objectname is the object, method is the action, and argument values are optional items
or instructions the method should use. A period separates the object name from the method.
window.open(Url, “”, “toolbar=no,width=500,height=400,status=no,resize=yes”)
window.alert(“This is a message”)
var ToDayDate=Date.toString( )
ticular task. The function can be used whenever that task is needed, eliminating the need
to repeat the code several times throughout an application. Functions replace large sets of
such as document, navigator, and history belong to the window object. These objects are
built-in and the methods that are associated with them are often referred to as built-in
functions. These include alert(), close(), open(), and print(). These functions actually
belong to the Window object. Because the Window object is assumed, developers often
Quick Reference in Appendix G.
In this project, user-defined functions use generic container tags to display dynamic
information. A container is an HTML tag that identifies a section of HTML code using
the id attribute so content of the tag can be set or defined by the use of the innerHTML
property. The <div> tag container defines a division or section of code that groups simi-
lar elements together. To uniquely identify this <div> container, use an id attribute, with
a unique id value not used by any other tag. In this project, the id value will be used by
tags or text, it can be used to dynamically display text at a particular location within a
An event is the result of an action, such as a mouse click or a Web page loading into the
this project, you first write the functions, and then the event handlers that will associate
the functions with specific events, such as loading the Web page.
Many Web sites provide
developers. To find
such Web sites, search
for keywords such as
good search engine.
Create a <div> tag container to display a dynamic message.
To display a dynamic message on a Web page, you must:
Identify the location within the Web page where you want a dynamic message to
display. In this Web page, you determine to place the dynamic message between the
two horizontal lines beneath the banner.
Create a <div> tag container for your message.
You need to create a <div> tag
container with an id attribute, which will identify that division as separate from any
other <div> tag and act as a holding location for the message. This container, working
in conjunction with the innerHTML property, will display the dynamic message.