After onclick code runs, open new window, close self?

K

Kathy Burke

Hi, could have sworn I used this before and don't understand why this
isn't working?

I have a button with onclick event:

do some database updates, etc.

then, open a new window (a confirmation that updates are done) and close
the current form.

If lreturn2 <> -1 Then

Response.Write("<script
language=javascript>parent.right.location='ErrorMsgEmail.aspx'</script>"
)

Else
'load confirmation page
Response.Write("<script
language=javascript>window.opener.location='UserMsgTimerClose.aspx';self
.close()</script>")

End If

In debug (vb.net), the Response.write line in Else gets highlighted but
then the form just "appears" and ignores it. I tried putting a variable
on page load (if postback) but the page doesn't reload after "submit".

Admittedly, a bit confused, if anyone is in the mood to enlighten me?

Thanks, Kathy
 
P

Paul W

Not sure why you want to close "_self", I would think it's kind of dangerous
if you are persisting anything with Session State variables.

Here is the code I use to open new window

Response.Write("<script language=javascript>")
Response.Write("window.open('someform.aspx', 'somewindowname', 'toolbar=no,
other window options...');")
Response.Write("</script>")

Hope this helps
Paul W
 
K

Kathy Burke

Hi, I need to close the opener window...it is the end of what the user
will do (internal app).

That exact script worked in another page, just wondering what
circumstances might be where it would be prevented from
working...mystery to me.

Thanks,
Kathy
 

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,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top