|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Okay somebody out there must know how to do this. I have a script to open a new window, nothing overly difficult. But than I would like to open another one off the Flash File. If the user leaves the first open the new one goes in there and it does not use the proper variables to size the window. Is there a way to close a window from outside the window (by naming it or whatever) so that when I click on another link it opens a totally new one ? I have been told that there is a script that closes one window before opening another, anyone that can help me ?
Thanks ------------------ Shawn Ryder Multimedia Designer http://www.learningdesignstudios.com |
|
#2
|
|||
|
|||
|
If I understand you correctly, you have a browser open, you click a link and want a new window to open, you then click another link to open a third window(including browser) then you want to close the second window. The problem you are having is that the page you want to come up in the third window is coming up in the second. If this is the case, when you open the third window, specify a different name as you thought. To close the second window that called the third window, use the following:
<head> <script language="JavaScript"> window.opener.close(); </script> </head> If this doesn't work, let me know. mroberts@naxs.com |
|
#3
|
|||
|
|||
|
Thanks for the help, but I am a little confused. Does the code go in the HEAD of the original browser window or in the second one ? and if it goes in the first how do you call on the function ?
------------------ Shawn Ryder Multimedia Designer http://www.learningdesignstudios.com |
|
#4
|
|||
|
|||
|
You can't close the window that is going to open the new window because it will never process the code to open the new window. You can try two things: First you can open the new window, then at the end of your program do a window.close or self.close (this code will go in the window that you want to close) or you can open the new window and the first piece of code that will be processed is the code that I sent earlier. Just remember that the computer processes code from the top going down. You have to open the new window before you can close the window that is calling the new window.
If you do it the first way: call your function to open the new window, then the last piece of code in your program, do a window.close() or self.close() ... you can do this right before your end </body> tag(put in the <script language="JavaScript">window.close() or self.close()</script>. If you do it the second way: open the new window as you normally would (name it differently), then put the code snippet that I sent you in the head of the most recently opened window. (the last one opened) That way, the first thing that will happen in the newest window will be to close the window that called the newest window. |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > Need some help with pop up windows |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|