Pop-up window not getting focus?

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
 
Y

yyj

Please take this:
Response.Write("<scr"+"ipt> alert('alert!the pwd had been changed!')
</scr"+"ipt>");
 
K

Kathy Burke

Please tell me why? The script works in other places, why would this
cause it not to have focus?

Thanks,
Kathy
 
K

Kathy Burke

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
 
D

Darrin J Olson

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
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top