HTML and CSS Reference
In-Depth Information
The open() method is used to create a pop-up window. Table 10-27 shows the
general form of the open() method.
Table 10-27 open() Method
General form:
var windowname=open(“window file name(URL)”, “object name”,
“features”)
Comment:
where windowname is an optional name of a window object (required only if you need to refer
to the pop-up window in any other Web page); window file name is the name of the HTML file;
and features describe how the window should appear.
Examples:
open(“chapter10-1notice.html”,”noticeWin”,”width=520,height=330”)
As shown in Table 10-27, when adding the open() method to create a pop-up
window, all of the pop-up window features must be enclosed within one set of quotation
marks. Table 10-28 describes the more commonly used attributes of the open() method,
which are used to define pop-up window features. For more information about the open()
method, see the JavaScript Quick Reference in Appendix G.
Table 10-28 open() Method Attributes
Feature
Description
Written As
height
States height in pixels
"height=450"
location
Includes address bar
"location=yes"
menubar
Includes menu bar
"menubar=yes"
resize
Allows user to resize
"resizeable=yes"
scrollbars
Includes scroll bars
"scrollbars=yes"
status
Includes status bar
"status=yes"
titlebar
Removes title bar
"titlebar=yes"
toolbar
Includes toolbar
"toolbar=yes"
width
States width in pixels
"width=220"
In this chapter, the open() method is used to open a pop-up window that will
display information about Shoreline State Bank services. You will insert code for the
popUpNotice function and open() method, and then add an event handler to call the
popUpNotice() function when the page is loaded. Earlier in the chapter, the onLoad
event handler was associated with the scrollingMsg() function. You will also use the
onLoad event handler for the popUpNotice() function. Multiple functions can be
associated with the same event handler.
Table 10-29 shows the code to create the user-defined function popUpNotice().
The chapter10-1notice.html file has already been created and is stored in the Chapter10\
ChapterFiles folder of the Data Files for Students.
Table 10-29 Code to Open chapter10-1notice.html Pop-Up Window
Line
Code
101
function popUpNotice() {
102
open(“chapter10-1notice.html”,”noticeWin”,”width=520,height=330”)
103
}
Search WWH ::




Custom Search