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

  • Thread starter Thread starter Kathy Burke
  • Start date Start date
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
 
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
 
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
 
Back
Top