[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: document.location problem



Thanks for the responses. I double-checked to make sure I had height 
and width for all the images and I did (haven't been bitten by that 
particular bug yet) and I tried Gordon's suggestion-and it still 
crashed. Perhaps I wasn't specific enough about what I was trying to 
do. What I'm basically trying to do is write a script that will read 
the last link in a document, and load that link into a frame. Here's 
my frameset:

<FRAMESET COLS="25%,75%">
	<FRAME SRC="TOC" NAME="toc">
<FRAMESET ROWS="85%,15%">	
	<FRAME SRC="coverpage.html" NAME="content">
	<FRAME SRC="navbar" NAME="navbar">	
</FRAMESET>
</FRAMESET>
 
And here's my script (with comments)

function getNext() {
	var i=parent.frames[1].document.links.length  
//return the number of links in the document

parent.frames[1].location=parent.frames[1].document.links[--i]
//Trying to set the location of the first frame to the last link in 
the current document (whose index number is 1 less than the number of 
links in the document)
}

The script works beautifully the very first time I use it (with an 
onClick event handler) If I try to use it a second time, it crashes 
Netscape (Mac).  It doesn't matter what document I have loaded into 
the first frame.  If someone out there can help me I'd be really 
grateful, because this script would be extremely useful for what I'm 
doing.

Thank you,
David Weingart
--------------------------------------------------------------------
For help about the list, please send a message to 'majordomo@obscure.org'
with the message body 'help'. To unsubscribe, send a message to
'majordomo@obscure.org' with the message body 'unsubscribe javascript'.
List archives and pointer to FAQ: http://www.obscure.org/javascript/