T
The Natural Philosopher
I've got two slight failuers in my knowledge here, and could do with
some help.
The situation in the first case is a window, which pops up a sub window
coupled to an onclick event.
Nothing to worry about there, but the subwindow then does its stuff and
causes the main window to refresh, also fine.
BUT if I then re-click on the main screen, I want to re-use the already
opened window. I.e to respawn it with a different GET variable to
display different data. I thought I had it working, but its unreliable.
This is the code called by the onlclick events.
var child1;
var child2;
function stock_click(type,id)
{
if(type=='CAT')
{
if(!child1 || child1.closed==true) // never bin opened or been closed
child1=
window.open("categories.php?nobanner=yes&category_id="+id,"_blank",
"height=600,width=1000,scrollbars=no,location=no,menubar=no,toolbar=no,status=no,resizable=yes");
else
child1.location.replace("categories.php?nobanner=yes&category_id="+id);
child1.focus();
}
else
{
if(!child2 || child2.closed== true) // see above..
child2=window.open("stockedit.php?nobanner=yes&id="+id, "_blank",
"height=768,width=1024,scrollbars=yes,location=no,menubar=no,toolbar=no,status=no,resizable=yes");
else child2.location.replace("stockedit.php?nobanner=yes&id="+id);
child2.focus();
}
}
The child window after updating the database calls this:-
function refreshParent()
{
if(opener!=null)
window.opener.document.forms[0].submit();
}
Forcing a reload of the main window.
I am wondering if this is what is causing the program to spawn multiple
windows instead of just one. I guess it must be as it will have wiped
out its 'knowledge' of what windows it has opened..
Any hints on how to achieve the desired activity would be most welcome.
The second problem is fairly simple conceptually.
I have a form, which when submitted,. may, depending on whats been
selected, need to cause a popup to appear to download a file.
So I select some data, and then click the go button, and I want a
download to appear.
I think I am correct in thinking this has to be a javascript browser
side thing? I cant suddenly turn a server side session into two sessions
by forking at the server?
I.e. my php script at the server cant fork() and spawn a subwindow? The
browser itself has to request a second window be opened with different
data yes?
If that is indeed true I think the answer is relatively simple: normally
when I hit the button I submit the forme loaded with its POST variables,
but in this case I need to call a second instance of it..will the POST
variables get passed even if an actual submit() has not been called? or
do I have to use get variables instead?
some help.
The situation in the first case is a window, which pops up a sub window
coupled to an onclick event.
Nothing to worry about there, but the subwindow then does its stuff and
causes the main window to refresh, also fine.
BUT if I then re-click on the main screen, I want to re-use the already
opened window. I.e to respawn it with a different GET variable to
display different data. I thought I had it working, but its unreliable.
This is the code called by the onlclick events.
var child1;
var child2;
function stock_click(type,id)
{
if(type=='CAT')
{
if(!child1 || child1.closed==true) // never bin opened or been closed
child1=
window.open("categories.php?nobanner=yes&category_id="+id,"_blank",
"height=600,width=1000,scrollbars=no,location=no,menubar=no,toolbar=no,status=no,resizable=yes");
else
child1.location.replace("categories.php?nobanner=yes&category_id="+id);
child1.focus();
}
else
{
if(!child2 || child2.closed== true) // see above..
child2=window.open("stockedit.php?nobanner=yes&id="+id, "_blank",
"height=768,width=1024,scrollbars=yes,location=no,menubar=no,toolbar=no,status=no,resizable=yes");
else child2.location.replace("stockedit.php?nobanner=yes&id="+id);
child2.focus();
}
}
The child window after updating the database calls this:-
function refreshParent()
{
if(opener!=null)
window.opener.document.forms[0].submit();
}
Forcing a reload of the main window.
I am wondering if this is what is causing the program to spawn multiple
windows instead of just one. I guess it must be as it will have wiped
out its 'knowledge' of what windows it has opened..
Any hints on how to achieve the desired activity would be most welcome.
The second problem is fairly simple conceptually.
I have a form, which when submitted,. may, depending on whats been
selected, need to cause a popup to appear to download a file.
So I select some data, and then click the go button, and I want a
download to appear.
I think I am correct in thinking this has to be a javascript browser
side thing? I cant suddenly turn a server side session into two sessions
by forking at the server?
I.e. my php script at the server cant fork() and spawn a subwindow? The
browser itself has to request a second window be opened with different
data yes?
If that is indeed true I think the answer is relatively simple: normally
when I hit the button I submit the forme loaded with its POST variables,
but in this case I need to call a second instance of it..will the POST
variables get passed even if an actual submit() has not been called? or
do I have to use get variables instead?