SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
-
Oct 26, 2010, 22:40 #1
- Join Date
- Oct 2010
- Posts
- 1
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Help,how the way to pop out screen auto closed and go back to specify page??
I'm newbie on SitePoint and also is a beginner programmer on ASP.
I meet a troubles on my current project and no idea to fix it up.
I've a pop out screen is created by Java Script,and this allows user to edit
or modifier some of data.When clicked submit, my pop out screen will closing and refreshing host page.
-
Oct 27, 2010, 04:11 #2
- Join Date
- Oct 2002
- Location
- Scotland
- Posts
- 3,631
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
This is really a Javascript question. Maybe make a post in that forum?
-
Oct 27, 2010, 10:12 #3
- Join Date
- Oct 2001
- Location
- Vancouver BC Canada
- Posts
- 2,037
- Mentioned
- 5 Post(s)
- Tagged
- 0 Thread(s)
Well I suppose it is a JavaScript question but if it's part of an ASP script it's probably a bit more involved than our friends over in JavaScript land can help with. The thing is, you have to refer to the page that opened the pop-up as an opener.document in JavaScript.
You can direct that opener.document by using opener.document.location = 'somepage.html'. If you want to refresh that page you just direct it back to the page it was on.
I usually add a little JavaScript and sometimes some ASP if I want to direct my opener page somewhere else in the body tag of my pop-up window. You are using a pop-up window right?
If you add the following to any pop-up html page it will close and redirect the opener page wherever you want to:
HTML Code:<body onload="window.close();" onunload="opener.document.location = 'somepage.html'">
I create a bodyTag variable that I stick in the body of the pop-up window:
HTML Code:<body <%=bodyTag%>>
The trick is you have to tell the opener.document.location where you want to refresh it to. So if it's default.asp then you set myReferrer = "default.asp".
Code:'If the update was successfull, close the window and refresh the main page. myReferrer = "default.asp" bodyTag = "onload=""window.close();"" onUnload=""opener.document.location = '"&myReferrer&"'"""
Make sense?Andrew Wasson | www.lunadesign.org
Principal / Internet Development
Bookmarks