Thread: book code
View Single Post
  #1 (permalink)  
Old June 28th, 2004, 02:40 PM
skicrud skicrud is offline
Authorized User
 
Join Date: Sep 2003
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default book code

On page 242 of javascript edition 1 has the following code;
<html>
<head>

<script language=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=50%,*>
<frame name=fraLeft src="page_a.htm">
<frame name=fraRight src="page_b.htm">
</frameset>
</html>

the next page uses 4 copies of the following naming then page_a through page_d;

<html>
<head>

<script language=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=50%,*>
<frame name=fraLeft src="page_a.htm">
<frame name=fraRight src="page_b.htm">
</frameset>
</html>

when I run the code I keep getting object expected error.
Can anyone help me???????:(

Reply With Quote