Strange Popup JS window behavior

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
 
K

Ken Cox [Microsoft MVP]

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
 
K

Kenneth

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
 
K

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
 
K

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,297
Latest member
EngineerD

Latest Threads

Top