Sorry, I don't know much about javascript as you probably guessed. I ended up doing what I needed to do in a different way and it works, but I'd still like to learn why what I did before didn't work. Please tell me if I'm totally confused - javascript is something I can't get the hang of no matter how many times I try or tutorials I read.
The document structure is like this:
Index.html is a document with two frames, frame_menu (navigation) and frame_body (content). Some of the pages that load in frame_body have links that create popup windows called popupwin, and some of the pages that load in popupwin have links that are supposed to target the _top of the original window.
I was going to use php to control what loaded in the frames, like index.html?menu=thing1&body=thing2, to get around the fact that you can't bookmark or link to specific content in a frameset. That's why the links in the popup window neeed to be able to target the url of the window with index.html in it. When a link had a script with a perumatation of
window.opener.parent it worked correctly the first time a link was clicked since it was targeting the parent of the window that opened the popup. But then the frame that had spawned the popup wasn't there any more, so every time a link was clicked after the first time nothing happened. That's why I couldn't use window.opener.
So, I named the original window that started with index.html in it "originalwindow" and added
window.parent.name="originalwindow"; to every page that loaded in frame_body to make sure the parent window was named "originalwindow" at all times. I know the name "originawindow" is being preserved because any normal link (like <a href="http://forums.x10hosting.com/programming-help/index.html?menu=thing1&body=thing2" target="originalwindow">) in any place (frame_body, frame_menu, or popupwin) always works correctly, but I couldn't find out how to write a script that targets originalwindow by name and changes its url. Something like
originalwindow.location.href = 'http://www.google.com'; was the only thing I could think of but of course it didn't work.
I know this is overly complicated and I'm probably doing things totally wrong but I'm trying to use it as an opportunity to learn by figuring it out. I know "frames are bad" and "popups are bad" but right now they're the only way to get the functionality I need. I've considered every alternative I can find and haven't found one that works as well for what I'm doing as frames. But I'm trying to write everything in a way that can easily be changed later if I do find a way that's better, hence all the php and javascript. (This site will have a very large number of pages and I'm concerned about having to re-write all of them if it changes to non-frames later.)
After working on it for a while I'm thinking of going to go back to doing it normally instead of using PHP. It's too slow and jarring since the whole frameset reloads every time you click a link, plus you lose your place in the menu whenever you click a link. The whole reason I'm using frames is so the user's place in one frame can be preserved while the other frame changes. (I tried using anchors in the menu pages so when the menu reloaded in the frame it would have the thing you clicked at the top, but it still felt very awkward.)
Sorry this is so long, I hope it makes sense :nuts: