Connecting Tech Pros Worldwide Forums | Help | Site Map

IE behaviour vs. window.open

Yves-Alain NICOLLET
Guest
 
Posts: n/a
#1: Jul 23 '05
In a HTML page, I have this javascript function:

function PopWindow(WinName, WindowUrl) {
if (document.ShowDocs.show[0].checked)
popup = window.open(WindowUrl, "MyWindow")
else
popup = window.open(WindowUrl, WinName)
}

and further:

<form name="ShowDocs">
....
<input TYPE="radio" NAME="show" value=same checked>
<br>
<input TYPE="radio" NAME="show" value=diff>
....
</form>

and further:

<a href=javascript:PopWindow("win1","path/to/doc1")>document 1</a>
<a href=javascript:PopWindow("win2","path/to/doc2")>document 2</a>
<a href=javascript:PopWindow("win3","path/to/doc3")>document 3</a>

How is it that it works OK with NS4, NS7, Mozilla, but that IE opens
each document in a separate window even if the first "show" radio is
checked?

I have added an alert(document.ShowDocs.show[0].checked) at the
beginning of the function and it gives "true".

Thanks for a clue...

Mike
Guest
 
Posts: n/a
#2: Jul 23 '05

re: IE behaviour vs. window.open


> popup = window.open(WindowUrl, "MyWindow")

By "MyWindow" do you mean the name of the current window? So you are
expecting that the URL be loaded in the current window and not in a popup?

If this is true then replace this line of code with:

window.location.href = WindowURL;

no need to use the open method.

Mike


Yves-Alain NICOLLET
Guest
 
Posts: n/a
#3: Jul 23 '05

re: IE behaviour vs. window.open


No, MyWindow is an arbitrary name for a new window. I could have
called it XYZ or WhatEver. But I really need to use open since I want
the new document to show up in another window than the one holding the
original link; if this window is not yet created, then it should be,
and if already created, it should be reused. But the real question is:
why all browsers *but IE* understand my script and what should I do
for IE to understand it too?

"Mike" <nospam@please.com> wrote in message news:<c6u4vb$kti$1@news1.wdf.sap-ag.de>...[color=blue][color=green]
> > popup = window.open(WindowUrl, "MyWindow")[/color]
>
> By "MyWindow" do you mean the name of the current window? So you are
> expecting that the URL be loaded in the current window and not in a popup?
>
> If this is true then replace this line of code with:
>
> window.location.href = WindowURL;
>
> no need to use the open method.
>
> Mike[/color]
Closed Thread


Similar JavaScript / Ajax / DHTML bytes