Opening a new window then open in old window?

My HTML has a frameset front page with a left frame containing a menu that opens pages in the main (right) frame using

<A HREF="" TARGET="MAIN_RIGHT"..>

where MAIN_RIGHT is the name of the main frame on the page. This works fine until I open a product window with the following javascript function:

function openwin(url)
{
      window.name="mainwin"
      window.open(url, "prodwin", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=400,height=400');
      
}

After I have opened one of these product windows the links in my menu frame open another new window instead of opening the page in the MAIN_RIGHT frame. Why does it do this and how do I correct it?

Cheers,

Dave.
LVL 1
yerffoegAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

knightEknightCommented:
Try this:

function openwin(url)
{
  top.open(url, "prodwin", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=400,height=400');

}
0
knightEknightCommented:
The problem is that in your function you are renaming the current window to "mainwin", and therefore the frame name changes, so any further references to it must open a new window.  The code above should eliminate that problem for you.
0
yerffoegAuthor Commented:
I didn't realise it was that simple, I got the code from a colleague who didn't really understand how he had done it and I am not too good at javascript. Before I give you the points can you answer another question for me - will this work on both IE4+ and NN4+? Post your response as an answer and I'll accept it.
0
knightEknightCommented:
I'd have to say a qualified yes to your question about NS and IE.  I am unable to try it both, but as far as I can tell by looking at the code, it should work!  Glad to help.

function openwin(url)
{
   top.open(url, "prodwin", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=400,height=400');
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
yerffoegAuthor Commented:
Thanks for your answer it saved me a lot of bother trying to work it out myself!

Dave.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.