473,763 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Window.open and window.setFocus

Hi folks,

Have been trying to figure out a solution for the following problem by
reading lots of threads here, but doesn't work out. Hope someone can
help me.

I have a parent window which opens a popup window (child). What i
would like to do, is to be abke to keep surfing to other pages in the
parent and after (lets say) a couple of new pages, still be able to
say "child.setFocus ()";

The solutions i found here for setting focus on childs, all have to do
with:

var NAME = window.open.... ..
NAME.setFocus.. ..

But after refreshing the parent, i won't have the ability to call NAME
anymore or do i? Is there a way to call a child by using it's window
name, the one you give it when using window.open?

tnx in advance, Ben
Jul 20 '05 #1
1 27588
Ben Smeets wrote:
I have a parent window which opens a popup window (child). What i
would like to do, is to be abke to keep surfing to other pages in the
parent and after (lets say) a couple of new pages, still be able to
say "child.setFocus ()";

The solutions i found here for setting focus on childs, all have to do
with:

var NAME = window.open.... ..
NAME.setFocus.. ..

But after refreshing the parent, i won't have the ability to call NAME
anymore or do i?
No, you have not, `NAME' is then forgotten. The same goes for access after
navigating to other pages. You can workaround that, e.g., when using a
frameset and store the reference as property of the frameset Window object:

parent.NAME = window.open(... );

(Although JavaScript is case-sensitive, `NAME' as property for Window
objects is to be avoided since such objects already have a `name' property.)
Is there a way to call a child by using it's window name,
Use Google (Groups). `NAME' is _not_ the window's (internal) name,
it is the identifier of a reference to the created Window object.
the one you give it when using window.open?


If the window referenced by `NAME' is still open,

(window.open(". ..", "foobar", "...") || window).focus() ;

will do the trick. `foobar' is the same name you used when openened
the window the first time. However, the `foobar' window will most
certainly refresh before it is focused even if the URL is the same.
PointedEars
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4169
by: Yang Li Ke | last post by:
Hi guys, let's say I want to load a window behind the main window. how do i do it? because right now everytime i do it the main window gets behind and the new window get the focus. Thank you.
4
10285
by: KS | last post by:
Is it possible to write a javascript that makes a popup window when someone click on buttons/href on my page and close itself when the new page is about to get loaded? I want to prevent the user from clicking anything else on my page while the request is getting a new page. The popup window must lock the focus. I use frames i can not just disable all the buttons an href in different frames.
1
1886
by: FireGeek | last post by:
I have used VBA to code the opening of a report as follows: stDocName = "WarrantyListUnitSpecific" DoCmd.OpenReport stDocName, acPreview, , "UnitType = '" & uType & "'" DoCmd.Maximize Form_frmUnitTypeSelection.SetFocus DoCmd.Close The DoCmd.Maximize maximizes not only the Report but also the Switchboard with the Switchboard on top. I would like the Report on
2
11909
by: Len4ik | last post by:
If I open Microsoft Access project without database window, how can I show it from VBA? I don't use startup option "Show database window". In the project disable option "special key". How can I show database window from VBA in opening Access project? Any ideas?
9
2832
by: Mark | last post by:
Hi All, I am trying to use the function found on the MVP site http://www.mvps.org/access/api/api0019.htm to hide the Access window. I must be missing something as I keep getting an error message: "You entered an expression that requires a form to be the active window". I have a popup form set to open when the DB is opened. On the open event of the form, I have the following code: fSetAccessWindow (SW_HIDE) as instructed on the web page....
6
34287
by: Jack | last post by:
I have a main webpage that has a list of records, each with a link to a window.open function call. As an example, a page that opens is editrecord.aspx?RecordID=34, and another is editrecord.aspx?RecordID=52. If the user starts changing the contents of the opened window, and then leaves it open and goes back to the main page, refreshes the list, and clicks on the same record link again, it reloads the contents of the page the user had...
2
1826
by: kaosyeti | last post by:
hey... i have a form with a cmd button that opens a 2nd form with acdialog as the windowmode. upon opening, if certain fields are filled, i would like to pull those values into some of the controls of the new form. here's the code i have in the open even of the 2nd form: If CurrentProject.AllForms("form1").IsLoaded = True Then If IsNull(Forms!form1.Controls!txtboxdate) = False Then Me.txtboxdate = Forms!. End If If...
3
14464
by: superjacent | last post by:
Hope someone can help. I have a listbox displaying time periods in blocks of 15 mins for a 24 hour period, all up 96 rows. The listbox can only visibly show 20 rows a time. The default feature is that the first row is at the top of the listbox.
2
1690
by: davidogutu | last post by:
Hello there, I am doing a school project and we haven't been taught lots of VBA. To earn more marks, I copied this example (it's allowed-research) from databasedev.co.uk and I want to make the 'admin' to see a different form from the 'limited user' You can download it from http://databasedev.co.uk/downloads/login.zip I would appreciate the help. Thanks in advance. Here is the VBA code:
0
9563
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10145
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9998
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9822
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7366
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.