using an array to update frames - Something is wrong (Posted by zman)

They have: 11 posts

Joined: Sep 1999

This script works until I got to yahoo, then I get an error when I try to go back to the other pages. Page 1,2 and 3 are all in the same directory as my left and main frame...left is the menubar that updates the main frame...am I referencing them improperly to be able to go back and forth? I can go to yahoo, or I can access page 1,2,3, but I cant do all in a sequence. PLEASE HELP!

<html>
<head>
<script>
pageArray = new Array ("","page1.htm","page2.htm","page3.htm",
"http://www.yahoo.com")

function setContent(thisPage){
parent.main.document.location.href = pageArray[thisPage]
}
</script>
</head>
<body bgcolor="teal">
<a href="JAVASCRIPT:setContent(1)">page1</a><br>
<a href="JAVASCRIPT:setContent(2)">page2</a><br>
<a href="JAVASCRIPT:setContent(3)">page3</a><br>
<a href="JAVASCRIPT:setContent(4)">Yahoo</a><br>
</body>
</html>

They have: 5,633 posts

Joined: Jan 1970

Do you have a this site up on the net? eg. url. I can't really figure it out unless I can see all the pages that are involved.

----------
[email protected]
http://go.to/hass

They have: 11 posts

Joined: Sep 1999

Yes it is, however it is much more complex, and I changed the address to an absolute reference. Only button one and two work...and only independantly. Be patient on button 2, it is a government server and is slow to load! I tried to provide a simplified example thinking it might be a simple answer!

www.hia.net/zman/

They have: 11 posts

Joined: Sep 1999

Update, I have reloaded the page at www.hia.net/zman/ and you will find that button 1,3,and 4 work fine, as does button 2, however once you go to button 2(yahoo), you get a javascript error if you try to go back to any of the other buttons! Please disregard the rest of the buttons, they are not programmed yet.

They have: 5,633 posts

Joined: Jan 1970

I see what you mean. I would suggest loading yahoo into a new window instead of keeping it within the frameset.

----------
[email protected]
http://go.to/hass

They have: 11 posts

Joined: Sep 1999

I'm sure that would work, but how would I keep the user on my site?....is there a way to re-work my html
so I can keep it all in my frames w/o the array?
ex. <a href hazards.htm TARGET="main"; hazards.htm TARGET="topp"> In other words...forget the array..how would I program it in regular html?

They have: 11 posts

Joined: Sep 1999

Anyone else want to try this...still looking for help
The basic code can be found at http://www.chalcedony.com/javascript/
look at th source for chapter4 loading a frame.
If you substitute www.yahoo.com for any of the urls in the array, it wont work after selecting that link.
There must be a way to restate te urls in the array to accept intermixed relative and absolute addresses!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.