Pop-up window not getting focus?

  • Thread starter Thread starter Kathy Burke
  • Start date Start date
K

Kathy Burke

Hi, I've used the following javascript structure in other places in my
asp.net app, but for this one the pop-up window still goes to the back
and doesn't get the focus.

button onclick event:
Response.Write("<script>var w=window.open('ECN.aspx', 'ECN',
'width=650,height=550,top=50,left=100,toolbar=no,menubar=no,resizable=ye
s');w.focus();</script>")

Any ideas how to make this work or what could be causing the behavior?
I'm calling it from a form that is in a frameset.

Thanks,

Kathy
 
Please take this:
Response.Write("<scr"+"ipt> alert('alert!the pwd had been changed!')
</scr"+"ipt>");
 
Please tell me why? The script works in other places, why would this
cause it not to have focus?

Thanks,
Kathy
 
Hi, I was given told to use this in answer to my question:

response.write("<scr"+"ipt> alert('alert!the pwd had been changed!')
</scr"+"ipt>");

I would like to understand what this does and why would it make the
pop-up get focus???

Thanks for enlightenment.

Kathy
 
This will create a pop up 'message box' on the client. This will not help
you pop up another browser window with a page in it, or give a different
window focus. I'm not sure why you need to concatenate the text in the
'script' tags. It will give focus to the 'message box' window, where you can
send text in the message.

You can use the RegisterClientScriptBlock() method to write the client
script to the page, instead of the Response.Write() method.
In the text parameter for the script block, you will need to send some
client script to open a new window, like window.open() in Javascript. When
that page loads, you can have a client script in the Load event that says
window.focus(), which will give itself focus when it loads.

I hope that helps some.

-Darrin
 
Back
Top