View Full Version : window.open problem in IE

05-15-2007, 05:11 PM
Hi guys & gals,

got a problem with this bit of script...


<script language="JavaScript"><!--
function myOpenWindow(str) {
myurl = 'view.asp?callbackID=' + str
myWindowHandle = window.open(myurl,'CB or Action','width=600,height=600,scroll=auto');
eval('document.view' + str + '.submit()');

<form name="view<%=(rsActions.Fields.Item("callbackID").Value)%>" action="../clients/viewdetails.asp">
<div align="right">
<input type="submit" name="Submit" value="Go To" onClick="myOpenWindow(<%=(rsActions.Fields.Item("callbackID").Value)%>)">
<input name="callbackID" type="hidden" id="callbackID" value="<%=(rsActions.Fields.Item("callbackID").Value)%>">
<input name="action" type="hidden" id="action" value="<%=request("action")%>">
<input name="sd_to" type="hidden" id="sd_to" value="<%=request("sd_to")%>">
<input name="sd_from" type="hidden" id="sd_from" value="<%=request("sd_from")%>">
<input name="searchdate" type="hidden" id="searchdate" value="<%=request("searchdate")%>">
<input name="clientID" type="hidden" id="clientID" value="<%=(rsActions.Fields.Item("clientID").Value)%>">


now the script works great in FireFox, then new window opens and the form is submitted which takes you to the next page. However trying this in IE it doesnt work??

Any ideas why or how to do a cross browser fix??



05-15-2007, 07:23 PM
why do you have all those hidden input types.

05-15-2007, 08:26 PM
The name parameter in window.open needs to not have spaces in it.

myWindowHandle = window.open(myurl,'CB_or_Action','width=600,height=600,scroll=auto');

05-15-2007, 08:40 PM
many thanks, that fixed it a treat!

05-15-2007, 10:28 PM
It's not good to use eval. Change this:

eval('document.view' + str + '.submit()');


document.forms["view" + str].submit();

See the square bracket notation in my sig for more info on it.