Click to See Complete Forum and Search --> : window.open


Taliv
02-05-2003, 10:52 AM
I have a browser window with a table, 500 rows, including a column for name. I have linked the name to a new window that opens with details BUT the parent window jumps to the top, so when I close the window I have to scroll down to line 432 again....

If I add an id to each name (row), after I open the new window, how do set the focus to line I have come from in the main window. (with the child window still open)

Thanks in advance to all of you!

Zach Elfers
02-05-2003, 10:55 AM
I can't understand why the parent window should scroll. Can you post your code?

Taliv
02-05-2003, 11:02 AM
Here is the code

<script language="JavaScript">
<!--
<!--
function ShowPopupPage(page, windowName, width, height, idNum)
{
var popup = window.open(page, windowName, 'left=0 top = 0 toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=' + "550" + ',height=' + "550");
if (navigator.appName.substring(0,8) == "Netscape")
{
popup.location = page;
}
return popup
}
//-->
</script>

... and then in a loop
<tr>
<td>
<a href="#" onClick = "javaScript:ShowPopupPage('viewDetails.asp?idNum= <%=recordDisplay(i,1)%>','','700','700',<%=recordDisplay(i,1)%>)">
<%=recordDisplay(i,4)%>, <%=recordDisplay(i,3)%>
</a>
</td>
</tr>

pyro
02-05-2003, 11:27 AM
Try changing this

<a href="#" onClick = "javaScript:ShowPopupPage('viewDetails.asp?idNum= <%=recordDisplay(i,1)%>','','700','700',<%=recordDisplay(i,1)%> )">

to this

<a href="#" onClick = "javaScript:ShowPopupPage('viewDetails.asp?idNum= <%=recordDisplay(i,1)%>','','700','700',<%=recordDisplay(i,1)%> );return false">

Unless you return false, it tells the page to go to the top. (the #)

Charles
02-05-2003, 12:41 PM
Except that that should be:

<a href="viewDetails.asp?idNum= <%=recordDisplay(i,1)%>" onClick = "return showPopupPage(this.href,'','700','700',<%=recordDisplay(i,1)%> )">

And your function showPopUpPage should return false at its end.