By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,224 Members | 1,233 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,224 IT Pros & Developers. It's quick & easy.

Howto: Child window make parent window into focus?

P: n/a

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
Jul 20 '05 #1
Share this Question
Share on Google+
9 Replies


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

Randell D. wrote:
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


Jul 20 '05 #2

P: n/a
Mike Scirocco <ms***@hotmail.com> writes:
<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
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3

P: n/a
Thanks.

Lasse Reichstein Nielsen wrote:
Mike Scirocco <ms***@hotmail.com> writes:
<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


Jul 20 '05 #4

P: n/a

"Randell D." <yo**************************@yahoo.com> wrote in message
news:sRGpb.285679$6C4.186378@pd7tw1no...

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...
Jul 20 '05 #5

P: n/a
DU
Lasse Reichstein Nielsen wrote:
Mike Scirocco <ms***@hotmail.com> writes:

<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


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

Jul 20 '05 #6

P: n/a

"DU" <dr*******@hot-R-E-M-O-V-E-mail.com> wrote in message
news:bo**********@news.eusc.inter.net...
Lasse Reichstein Nielsen wrote:
Mike Scirocco <ms***@hotmail.com> writes:

<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


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.
Jul 20 '05 #7

P: n/a
"Peeky" <em**********************@s.it.helps.everybody.com > wrote in
message news:4Agqb.313352$9l5.140463@pd7tw2no...
<snip>
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.
Jul 20 '05 #8

P: n/a
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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #9

P: 1
How would one do the opposite? That is by clicking the same link in the main window bring the child window into focus - as when browsing, if they try to return to the child via the main window, if it is already loaded it will not reaappear and this can confuse people into thinking it is not working, when it is just minimized.

Thanks


Myshkin
Jun 20 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.