Welcome to WebmasterWorld Guest from 126.96.36.199
Forum Moderators: open
<form name="testform" method="post" action="test.asp">
<input type="hidden" name="field" value="whatever">
<input type="button" value="go post" onclick="goPost2()">
myWin = window.open("page.htm","myWin","width=300")
document.testform.target = "myWin";
The form submit targets a new (like a _blank) window. I've tried everything including adding a delay (up to 8 seconds!) after the open. I've written the code a thousand different ways (without 'myWin =' etc, using a normal submit button and target attribute). I've installed IE5.0 SP2 without luck, upgraded to IE5.5 SP2 and it still didn't work. IE6 nada. The script engine is 5.6 (latest version) and yet it still refuses to target the window opened by script.
The window knows that it's name is myWin as I've used:
Please help me before I pull it all my hair, give myself concussion and damage the wall.
I really can't explain this and just assumed it an IE bug, but we've upgraded the browser three times and it's still there (they're W2K boxes).
It is necessary that you write the windows name in each of the targets. In form tag it is e.g.
onSubmit="window.open('', 'yourwindow', 'width=450,height=300,status=yes,resizable=yes,scrollbars=yes')"
document.testform.target = "myWin";
And I've tried it with the attribute on the <form> tag itself but it still isn't working no these two machines. I even cut and pasted your code and tried it - it didn't work.
This is baffling everyone I've had look at it. When it happened on one machine at first we kind of just put it down to a 'freak' event on a rogue machine... until we got another call.
Our concern is that going from the stats here we could be looking at 4% of users (admittedly, 2 out of 50 isn't the strongest basis for such a statistical analysis but thats our concern nonetheless).
Anybody heard of anything like this?
[edited by: joshie76 at 8:05 am (utc) on Sep. 30, 2002]
Machines here are built, like most other offices from a standard ghost. I've hunted through the installed programs and plug-ins but there's nothing out of the ordinary...
All machines have IE on them (various versions, one per machine).
What I don't see you doing, is setting a RETURN in your onSubmit, and in the JS function. As this link points out, the RETURN is what allows the blank window to open, before returning control back to the FORM tag with ACTION= .asp file.
Hope this helps, I grab tips off these Forums alot & it would be cool to give one for a change...
Unfortunatley I've tried the return method and just tested your exact code but these two machines still refuse to target the pop-up window.
If you really think about it programmatically then "the RETURN is what allows the blank window to open, before returning control back to the FORM tag with ACTION= .asp file." doesn't hold programmatically (especially if you consider the first example I posted with an added delay before the submit) but I'll try anything once. It's funny fixes like this that often sneak through.... no such luck.
I'm totally exhaused on this one. It would help If I knew the scale of the problem or whether it's just these two machines.
Thanks for trying tho'
I have the same problem that Josie76 encountered.
Here's a sample of my code :
document.all["frm"].target = sTarget;
var sTarget = document.all["frm"].target;
if (sTarget == "MyPopUp")
var sFeatures = "resizable=yes,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes";
sFeatures += ",width=" + screen.availWidth * 0.80;
sFeatures += ",height=" + screen.availHeight * 0.80;
sFeatures += ",left=" + screen.availWidth * 0.10;
sFeatures += ",top=" + screen.availHeight * 0.10;
var win = window.open("", "MyPopUp", sFeatures);
<FORM ID="frm" ACTION="mytargetpage.asp" METHOD="POST" TARGET="MyFrame" onSubmit="return JS_OnSubmit();">
<INPUT ID="btnExecute1" TYPE="SUBMIT" VALUE="Execute 1" onClick="JS_SetTarget('MyFrame')">
<INPUT ID="btnExecute2" TYPE="SUBMIT" VALUE="Execute 2" onClick="JS_SetTarget('MyPopUp')">
The goal is to display the content of mytargetpage.asp in a frame if btnExecute1 is pressed or in
a new window if btnExecute2 is pressed.
The POST method is used, because one of the parameters sent to mytargetpage.asp is a SQL query, which can be
very long and can embedded some problematic chars like '+'...
On some machine, this code works well. On others, a blank window is first opened (named 'MyPopUp') and
then a second one is opened, and the second one has the role of target!
NB: A greater value of timeout has no effect on this problem.
If someone could help...
Thanx in advance.