code_junkie

How can I reference a popup window from two different pages

Nov 13th, 2011
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. var playerWin = window.open("player.htm", "playerWin", "width=300,height=130");
  2. playerWin.play("song.mp3"); // play() is a function in player.htm
  3.  
  4. playerWin.play("tune.mp3");
  5.  
  6. <script>
  7. var w = window.open("p.htm", "playerWin", "width=300,height=130");
  8. </script>
  9. <a href="2.htm">2</a>
  10.  
  11. <a href="javascript:opener.w=this;">re-link</a>
  12.  
  13. <script>
  14. var w;
  15. </script>
  16. <a href="javascript:alert(w);">check</a>
  17.  
  18. user clicks on link in page-1
  19. page-1 asks it's parent window to open a popup
  20. popup opens
  21.  
  22. user navigates away (in the iframe)
  23. user clicks a link in page-2
  24. page-2 asks it's parent window to close it's popup
Add Comment
Please, Sign In to add comment