Strange Popup JS window behavior

  • Thread starter Thread starter Kenneth
  • Start date Start date
K

Kenneth

Hi,

function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops
= 'height='+h+',width='+w+',top='+wint+',left='+winl+',scro
llbars='+scroll+',resizable=0'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) {
win.window.focus(); }
}

between <head> tags

Page.RegisterStartupScript("details", "<script
language='JavaScript'>NewWindow
('showDetails.aspx','details',630,200,'yes');</script>")

is the code when I open a popup JS window

In design mode in VS.NET 2003 it works just fine, but when
I run it on from my production server the popup window
hides behind the calling window.

Any ideas?

TIA

/Kenneth
 
Hey Kenneth,

It works fine on my local machine, outside of the VS.NET environment.

I'm wondering if it is a timing thing where the main page is still rendering
its contents and somehow steals back the focus? Maybe there's a delay while
the page is compiled?

Ken
 
Is there in asp.net any property you can set that tells
the window to stay on top of all other windows?

In JS 1.2 there is a 'alwaysRaised' parameter to
the 'window.open' function, but I can't get that working
either.

/Kenneth
 
Perhaps, on this form I call for the JS function with two
calls, one from a button (doesn't work) and one from a
buttoncolumn in a grid (that works).

From the grid's ItemCommand I do:

If e.CommandName = "Change" Then
Page.Register....
End If

and from the Button_Click event I do:

Page.Register...

with identical calls.

What to do?

/Kenneth
 
Yes, it was a time delay problem.

I tried to include 'setTimeout' upon calling the JS
function with a delay with 200 ms and it all works just
fine.

/Kenneth
 
Back
Top