Java Reference
In-Depth Information
<head>
<title>Chapter 8: Example 3</title>
<script type=”text/javascript”>
var pagesVisited = new Array();
function returnPagesVisited()
{
var returnValue = “So far you have visited the following pages\n”;
var pageVisitedIndex;
var numberOfPagesVisited = pagesVisited.length;
for (pageVisitedIndex = 0; pageVisitedIndex < numberOfPagesVisited;
pageVisitedIndex++)
{
returnValue = returnValue + pagesVisited[pageVisitedIndex] + “\n”;
}
return returnValue;
}
function addPage(fileName)
{
var fileNameStart = fileName.lastIndexOf(“/”) + 1;
fileName = fileName.substr(fileNameStart);
pagesVisited[pagesVisited.length] = fileName;
return true;
}
</script>
</head>
<frameset cols=”200,*”>
<frame name=”frameMenu” src=”ch08_examp3_menu.htm”>
<frame name=”frameMain” src=”ch08_examp3_main.htm”>
</frameset>
</html>
As you can see, you've reused a lot of the code from ch08_examp2.htm , so you can cut and paste the script
block from there. Only the different code lines are highlighted. Save this page as ch08_examp3.htm .
Next, create the page that will be loaded into frameMenu, namely ch08_examp3_menu.htm.
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<title>Chapter 8: Example 3 Menu</title>
<script type=”text/javascript”>
function choosePage_onchange()
{
var choosePage = document.form1.choosePage;
var windowobject;
if (document.form1.radFrame[0].checked == true)
{
windowobject = window.parent.frameMain.frameTop;
}
else
{
windowobject = window.parent.frameMain.frameBottom;
Search WWH ::




Custom Search