469,647 Members | 1,769 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,647 developers. It's quick & easy.

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

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='ErrorMs gEmail.aspx'</script>"
)

Else
'load confirmation page
Response.Write("<script
language=javascript>window.opener.location='UserMs gTimerClose.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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #1
2 5380
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
Nov 17 '05 #2
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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Tim Williams | last post: by
17 posts views Thread by Mike Gratee | last post: by
4 posts views Thread by Gabriella | last post: by
3 posts views Thread by sungung | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.