Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- Targetting a window


joshie76 - 3:19 pm on Sep 27, 2002 (gmt 0)


Take the following (simplified) example:

<form name="testform" method="post" action="test.asp">
<input type="hidden" name="field" value="whatever">
<input type="button" value="go post" onclick="goPost2()">
</form>

<script type="text/javascript">
function goPost()
{
myWin = window.open("page.htm","myWin","width=300")
document.testform.target = "myWin";
document.testform.submit();
}
</script>

The code is opening a (javascript) window and then setting the target of the form to that new window. Great and it works on 48 out of the 50 machines here BUT, infuriatingly, it refuses to work on two IE machines.

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:
document.write(window.self.name) in page.htm.

Please help me before I pull it all my hair, give myself concussion and damage the wall.

Yours desparingly


Thread source:: http://www.webmasterworld.com/javascript/201.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com