Howto: Child window make parent window into focus?

R

Randell D.

Folks,

I'm working on a contact name/address database whereby a slimed down list is
shown in the main window. When a record is selected, the complete record is
displayed in a new window via a call to window.open

As opposed to closing and re-opening new windows, I would prefer that when
the user is finished reading the complete record, they can click a link
whereby the main window is sent in to focus.

Thus, a main (or parent) window opens a new window and the new window comes
in to focus. I *do not* want to close the new (child?) window, instead, I
want the parent window to come in to focus... Since the child is in focus,
how can I call a routine that will place the parent in to focus?

All help, via the newsgroup, is much appreciated,
thanks,
randelld
 
M

Mike Scirocco

<p><a href="javascript:window.opener.focus()" target="_self">Set Focus
To Opener Window</a></p>
 
L

Lasse Reichstein Nielsen

Mike Scirocco said:
<p><a href="javascript:window.opener.focus()" target="_self">Set Focus
To Opener Window</a></p>

Don't use javascript:-URIs. <URL:http://jibbering.com/faq/#FAQ4_24>
The "target" attribute does nothing, and can safely be omitted.
I.e.,
<p><a href="WhyYouNeedJSToUseThisPage.html"
onclick="opener.focus()">Set Focus To Opener Window</a></p>

However, the appropriate control to use for effects like this is a
button. Links link to other pages. Buttons have effects. In this case,
you want something to click to get an effect.

<p><input type="button" value="Set Focus To Opener Window"
onclick="opener.focus()"></p>


Please trim your quotes and preferably answer below the quoted content.
/L
 
M

Mike Scirocco

Thanks.
Don't use javascript:-URIs. <URL:http://jibbering.com/faq/#FAQ4_24>
The "target" attribute does nothing, and can safely be omitted.
I.e.,
<p><a href="WhyYouNeedJSToUseThisPage.html"
onclick="opener.focus()">Set Focus To Opener Window</a></p>

However, the appropriate control to use for effects like this is a
button. Links link to other pages. Buttons have effects. In this case,
you want something to click to get an effect.

<p><input type="button" value="Set Focus To Opener Window"
onclick="opener.focus()"></p>


Please trim your quotes and preferably answer below the quoted content.
/L
 
R

Randell D.

Randell D. said:
Folks,

I'm working on a contact name/address database whereby a slimed down list is
shown in the main window. When a record is selected, the complete record is
displayed in a new window via a call to window.open

As opposed to closing and re-opening new windows, I would prefer that when
the user is finished reading the complete record, they can click a link
whereby the main window is sent in to focus.

Thus, a main (or parent) window opens a new window and the new window comes
in to focus. I *do not* want to close the new (child?) window, instead, I
want the parent window to come in to focus... Since the child is in focus,
how can I call a routine that will place the parent in to focus?

All help, via the newsgroup, is much appreciated,
thanks,
randelld

Thanks...
 
D

DU

Lasse said:
Don't use javascript:-URIs. <URL:http://jibbering.com/faq/#FAQ4_24>
The "target" attribute does nothing, and can safely be omitted.
I.e.,
<p><a href="WhyYouNeedJSToUseThisPage.html"
onclick="opener.focus()">Set Focus To Opener Window</a></p>

However, the appropriate control to use for effects like this is a
button. Links link to other pages. Buttons have effects. In this case,
you want something to click to get an effect.

<p><input type="button" value="Set Focus To Opener Window"
onclick="opener.focus()"></p>


Please trim your quotes and preferably answer below the quoted content.
/L

Your reply, excellent as usual, explains (indirectly) why child windows
should not be maximized and why browser manufacturers never implemented
the code to enlarge child windows by force.
The code given is unneeded unless the child window is maximized. When
the user knows that clicking a link will create a secondary window or
when the user can easily see, notice that a new secondary window has
been created, then he does not need any code to give focus back to the
opener.
Maximizing a child windows or creating a very large and long child
window creates an usability problem, an usability burden that the given
code tries to compensate.

DU
 
P

Peeky

DU said:
Your reply, excellent as usual, explains (indirectly) why child windows
should not be maximized and why browser manufacturers never implemented
the code to enlarge child windows by force.
The code given is unneeded unless the child window is maximized. When
the user knows that clicking a link will create a secondary window or
when the user can easily see, notice that a new secondary window has
been created, then he does not need any code to give focus back to the
opener.
Maximizing a child windows or creating a very large and long child
window creates an usability problem, an usability burden that the given
code tries to compensate.

DU

Fair comment 'DU' if the web page was a normal website but I am developing
an intranet application - I want to reduce I/O (both client and server side)
so my idea is this:

1 Main window lists a basic list of names/addresses with links to a popup
window
2 When user clicks on one of the links, the full record is written to the
popup window and brought into focus.
3 When user is finished reading the record, they click on a link to return
the main window to focus.

This reduces I/O since the basic list of names/addresses do not need to be
retrieved everytime a single record is display (which would be the case if
everything was in a single window). The reason why I want a link on the
child window to bring the parent in to focus is I don't want a popup to be
opening/closing repeatedly - I prefer bringing one in and out of focus
instead.
 
R

Richard Cornford

message
This reduces I/O since the basic list of names/addresses do not
need to be retrieved everytime a single record is display (which
would be the case if everything was in a single window). ...
<snip>

Navigating a one-window interface back to the names/addresses list does
not impose the need to re-retrieve that date from a database.
Server-side session objects could be used to store the pertinent
information from an initial database look-up and (quickly) re-display
that information when needed. And that is particularly viable on an
Intranet application because the number of simultaneous sessions would
be relatively low and predictable. The session object is also in a good
position to know/find out when user interaction has resulted in changes
in the database and therefor when it would be necessary to re-retrieve
the information from the database.

Richard.
 
K

keyur shah

Pls specify for what kind of application u are seeking soluton vb.net,
asp.net, asp, javascript, jscript.net.....

Keyur Shah
Verizon Communications
732-423-0745
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top