• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

switching focus between a parent and child window?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, so here's the deal...
I have a parent window opened in canvas mode, and I launch a child window form that parent window. How can I use Javascript toggle between the two (because the parent is taking over the desktop, and blowing away all the Windows nav) without reloading the info in either page?
basically, I just want to switch focus between them, so that if you're on page 5 of the site in one window, anf switch to the other, and switch back, you're still on page 5. I don't want either window to reload or refresh, just come to the foreground when you click on the graphic.
Is there a function out there that can switch window focus?
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you want is the window.focus() method. Your child window can refer to its parent window with 'opener' - so the command in the child window would be opener.focus(), or window.opener.focus(). The parent should have given the child a name when it opened, so the parent can call childname.focus().
 
Ranch Hand
Posts: 3244
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tara
In the parent window that opens the new one you should be able to just say:
newWindowName.focus();
in the new window it would be:
opener.focus();

hope that helps

Dave
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The opener.focus replaces the present child window, actually i wanted to navigate to parent tab, leaving child tab un-altererted, using java script and html, is there any way for it ?

regards
Mohan
 
Destiny's powerful hand has made the bed of my future. And this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic