D
Dom Nicholas
Hi,
I would like to find a better way of doing the following. I have a
window (call it Win) that creates a new window (call it Win2). It
detects if the window already exists and brings it to the front if it
does (else it just creates it).
Please study and try the code below to try it and then read on.
The problem occurs when I reload window Win and hit the create-window
button. The Win2 window is reset and reloads from scratch. I want it to
just be brought to the top.
In my work what I do is have the Order button bring up an order form
from an item page. Then going to another item page hitting order should
not reload the order form since then all the previous item orders are
thrown away - I just raise it to the top if its hidden.
So my question boils down to this : how do I detect whether the window
created using the Order button exists from another window ? For example,
is there a window-id's container of some sort that hangs around that I
can interrogate ?
ok thanks for any help.
here's the code :
<html>
<head>
<script language="javascript">
var popupwin;
function NewWindow(mypage,myname)
{
if ( popupwin==null || popupwin.closed ) // the window doesn't exist
or is closed so create it and bring it to the top
{
popupwin=window.open(mypage,myname,""); popupwin.focus();
}
else
{
popupwin.focus(); // the window exists so just bring it to the top
}
}
</script>
</head>
<body>
<button type="button"
onClick="NewWindow('http://www.google.com','orderform')" >Order
</button>
</body></html>
-Dom
I would like to find a better way of doing the following. I have a
window (call it Win) that creates a new window (call it Win2). It
detects if the window already exists and brings it to the front if it
does (else it just creates it).
Please study and try the code below to try it and then read on.
The problem occurs when I reload window Win and hit the create-window
button. The Win2 window is reset and reloads from scratch. I want it to
just be brought to the top.
In my work what I do is have the Order button bring up an order form
from an item page. Then going to another item page hitting order should
not reload the order form since then all the previous item orders are
thrown away - I just raise it to the top if its hidden.
So my question boils down to this : how do I detect whether the window
created using the Order button exists from another window ? For example,
is there a window-id's container of some sort that hangs around that I
can interrogate ?
ok thanks for any help.
here's the code :
<html>
<head>
<script language="javascript">
var popupwin;
function NewWindow(mypage,myname)
{
if ( popupwin==null || popupwin.closed ) // the window doesn't exist
or is closed so create it and bring it to the top
{
popupwin=window.open(mypage,myname,""); popupwin.focus();
}
else
{
popupwin.focus(); // the window exists so just bring it to the top
}
}
</script>
</head>
<body>
<button type="button"
onClick="NewWindow('http://www.google.com','orderform')" >Order
</button>
</body></html>
-Dom