HTML and CSS Reference
In-Depth Information
Table 10.14 Methods of the location Object
Method
What It Does
reload()
Reloads the current URL.
replace()
Replaces the current page with a new one.
unwatch()
Removes a watch point on the location property.
watch()
Sets a watch point on the location property; that is, calls a function if the
property changes.
Two methods of interest (see Table 10.14) are replace() and reload() . The replace()
method is used to change the location of the current page; that is, to point to another
page. It is similar to the href property, but where href puts the new page at the top of the
history list, the replace() method removes the current page from the history list and
replaces it with the new page. The reload() method behaves like the browser's Reload
button. It causes the window's current document to be reloaded.
Loading a New Page into a Frame with the location Object. In Example 10.20,
the location object changes the location of the current page. By selecting a Web site, the
user is taken to that site, which is displayed in the bottom frame of a frameset.
EXAMPLE 10.20
(The file defining the framesets called framefile.html)
<html>
<head><title>Frames</title></head>
<frameset rows="130,*" frameborder="yes" border="8"
framespacing="0">
<frame src="location.html" scrolling="no">
<frame src="emptyframe.html" >
</frameset>
</html>
---------------------------------------------------------------------
(The empty file that will be the bottom frame called emptyframe.html)
<html>
<head>
<title>Empty Frame</title>
</head>
<body>
</body>
</html>
---------------------------------------------------------------------
 
Search WWH ::




Custom Search