HTML and CSS Reference
In-Depth Information
Table 10.5
Methods of the
window
Object (continued)
Method
What It Does
scroll(x, y)
Scrolls to a pixel position in a window.
setInterval(expression, milliseconds)
After a specified interval, evaluates an expression
(see Examples 10.10 and 10.12).
setInterval(function, milliseconds, [arguments])
After a specified interval, evaluates a function (see
Examples 10.10 and 10.12).
setTimeout(expression, milliseconds)
After a timeout period has elapsed, evaluates an
expression (see Examples 10.10, 10.11, and 10.13).
setTimeout(function, milliseconds, [arguments])
After a timeout period has elapsed, evaluates a
function (see Examples 10.10, 10.11, and 10.13).
Opening and Closing Windows.
You can open a new browser window by going to
the
File
menu and selecting
New Window
(Netscape and Internet Explorer), or you can
open a new window from a JavaScript program with the window's
open
method. These
little windows are commonly called popups. When creating these windows, keep in
mind that all major Web browsers now offer popup advertising filters, and your viewer
might not even see the popup.
FORMAT
var window_object = window.open("url", windowname, [options]);
EXAMPLE
var winObj= window.open("http://localhost/windows/winter.jpg",
"winter","width=1150,height=350,resizable=yes,scrollbars=yes,
location=yes");
EXAMPLE
10.7
<html>
<head><title>Opening a New Window</title>
<script type="text/javascript">
1
function newWindow(){
2
var winObj=open("winter.jpg", "winter");
}
</script>
</head>
<body bgColor="lightblue">
<h2>Winter Scene from the Old Country</h2>
Continues