473,626 Members | 3,231 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Positioning a child window relative to the parent

I have made a remote control window which opens from its parent. On
loading, the remote is positioned relative to the screen using
window.moveTo(x ,y).

What I would like to happen is the remote control to open docked in a
specific location relative to the parent (opener).

Fortunately, I need this to work ONLY in IE, so at least I don't have to
worry about cross-browser issues.

Does anyone know how to open a window realtive to an anchor in the parent
wiondow?


Jul 23 '05 #1
20 11064
VK
var winRef =
window.open("fo o.html","winNam e","height=100, width=200,left= 0,top=0");

Jul 23 '05 #2
Thank you for the response.

What you have shown allows positioning relative to the parent window, but
what I am looking for is a means of positioning relative to an *element* in
that window. For instance, I would like to open the window on top of a
table cell in the parent. Obviously that value will be variable depending
upon what toolbars, etc. the user has opened in the parent. Somehow I must
pass the anchor's postion in the parent window.

"VK" <sc**********@y ahoo.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
var winRef =
window.open("fo o.html","winNam e","height=100, width=200,left= 0,top=0");

Jul 23 '05 #3
Geoffrey H. Goldberg wrote :
Thank you for the response.

What you have shown allows positioning relative to the parent window,
?
No. The requested popup window is positioned relative to the user
screen, not the parent window.

but what I am looking for is a means of positioning relative to an *element* in
that window. For instance, I would like to open the window on top of a
table cell in the parent.

Why do you need a requested popup window to display whatever is in that
popup window? I'm sure there is a more suitable and user-friendly way to
do what your webpage requirements are without resorting to a secondary
window.

Obviously that value will be variable depending upon what toolbars, etc. the user has opened in the parent.


There is no direct and reliable way to figure out the user's browser
window toolbars and their height or total height. Even in Mozilla-based
browsers, the user can customize an hidden pref to avoid revealing the
outerHeight of the browser window.

Gérard
--
remove blah to email me
Jul 23 '05 #4
>Why do you need a requested popup window to display whatever is in that
popup window? <
My website is a project management portal encompassing 13 projects and a
total of something like 650 menu items. (And yes, they are all important).
I can not use frames because I do not want to sacrifice the real estate
(some of the data tables are very large). So I made a remote control window
for the menu system(s). It serves the purpose well. At present it opens
in the top left corner of the screen. The only reason why I want it to open
"docked" in the homepage (the parent window) is for aesthetics.
I'm sure there is a more suitable and user-friendly way to do what your
webpage requirements are without resorting to a secondary window.<


Not that I can think of, and I have studied this issue rather intensely.
Actually the site is extremely user friendly. I am curious as to why you
would assume that since the system uses two windows that it must be
otherwise. This system is used exclusively for engineering project
management, and not for casual website browsing.

Jul 23 '05 #5
VK
<your table>
<td
onclick="window .open('foo.html ','foo','width= 200,height=100, left='+this.off setLeft+',top=' +this.offsetTop +'\'')">
<your table>

Needs to be tune up slightly (+/-) for FF who has a separate opinion of
the coords calculation.

Jul 23 '05 #6
What this does is position the remote window relative to the screen at the
same offset as the anchor has in its cell.

I need a means of resolving the position of the inner browser window
relative to the screen. Once I have that it would be a relatively simple
matter to perform the math (by adding the offsets to the anchor, which are
constants).

The question comes down to: does IE report the position of the inner
browser window?

(I am not concerned with FF (or NN) because all of my users employ IE.)
"VK" <sc**********@y ahoo.com> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.com...
<your table>
<td
onclick="window .open('foo.html ','foo','width= 200,height=100, left='+this.off setLeft+',top=' +this.offsetTop +'\'')">
<your table>

Needs to be tune up slightly (+/-) for FF who has a separate opinion of
the coords calculation.

Jul 23 '05 #7
VK
> The question comes down to: does IE report
the position of the inner browser window?


Yes, sure. Why do you prefer to trust this group instead of Microsoft
itself? You thing they will try to cheat you? (a right thinking
though).
<http://msdn.microsoft. com/library/default.asp?url =/workshop/author/dhtml/reference/objects/obj_window.asp>
look for screenX and screenY properties there.

Jul 23 '05 #8
Geoffrey H. Goldberg wrote:
<snip>
The question comes down to: does IE report the position of
the inner browser window? <snip>

If the event that triggers the opening of the window is a mouse event
then it will have screenX/Y values that represent the screen offset of
the mouse and clientX/Y values that represent the offset of the mouse
into the client-area/viewport. The difference between these two values
is the screen offset of the client-area/viewport.

Then the sum of the page element's offset in the client-area (which is
also the element's page offset adjusted by the degree to which the page
is scrolled) and the screen offset of the viewport is the screen
co-ordinates of the page element.

Watch out for the borders on the root element of the page, which IE
defaults to 2px, and represents as the clientTop/Left properties of the
root element. It is likely that at lest one set of offsets will need
adjusting by that value (the symptoms of needing to make the adjustments
are finding a positioned result that is 2px off from where you were
expecting it).

Which element (HTML or BODY) is the root element depends upon the
setting of - document.compat Mode -. If that property is not implemented
in IE (<= 5.5) then the BODY is the root element, if it is implemented
(IE 6) then a value of "CSS1Compat " indicates that the HTML element is
the root, and BODY otherwise.
"VK" <sc**********@y ahoo.com> wrote in message

<snip>

Please do not top-post to comp.lang.javas cript. It will often be taken
as an indication that you are not interested in having your questions
answered. Certainly do not make the mistake of taking VK's behaviour
(or advice, without third party confirmation) as indication a wise cause
of action. See the group's FAQ:-

<URL: http://www.jibbering.com/faq/ >

Richard.
Jul 23 '05 #9

Yes it does, in mozilla you use .innerWidth and .innerHeight, in IE is
document.body.c lientWidth and document.body.c lientHeight.

Danny
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Jul 23 '05 #10

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

Similar topics

9
32046
by: Bryan R. Meyer | last post by:
Hello Everyone, The problem of browser resizing has become an issue for me. While redesigning my webpage, I set the left and right margins to be auto so that my content would be centered. However, there are images that I used absolute positioning in order to place them in the appropriate location on my page. When I do a browser resize, these images do not move (obviously). However, the rest of my content is auto centered as...
14
2469
by: Harlan Messinger | last post by:
What am I not understanding about the definition of { position: absolute; }? "The box's position (and possibly size) is specified with the 'left', 'right', 'top', and 'bottom' properties. These properties specify offsets with respect to the box's containing block." Please take a look at http://gavelcade.com/abspos.html and help me understand why my nested, absolutely positioned divs are being positioned with respect to the page rather...
4
8729
by: louissan | last post by:
Hi all, I've met a problem with Opera and its ability to render absolutely positioned divs inside relatively positioned parent blocks, themselves contained inside a relatively positioned block. I'm surely missing something, but what? Any help would be kindly appreciated :) Here's a code sample:
0
1764
by: Jonas Smithson | last post by:
<div style="position: relative;> <!-- I'm the parent --> blah blah blah <div style="position: absolute; bottom: 0;> <!-- I'm the child --> blah blah blah </div> </div> The bottom of the child div lines up with the bottom of the parent div in Win IE6 and in Win NS6. However, Mac IE5 has a nasty bug -- it lines up the bottom of the child div with the *top of the body* -- I kid you
1
11562
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx but it was far more complex then I needed. (I got lost trying to figure it all out). Therefore, here goes my simple "web dialog box with parent event handler fireing" solution. ...
2
2487
by: Rob R. Ainscough | last post by:
I'm slowly (very slowly) working my way thru the bizarre and sadistic world of control positioning in MultiViews (ASP 2.0). I came across this to help me explain (or attempt to anyway) why my web page controls were all over the place. "Ironically, absolute positioning is relative. Yes, you read that right. An absolutely positioned element is positioned relative to another element, called the containing block. Here comes the definition...
3
1589
by: kraftyhunter | last post by:
Ok here is the pickle. I have got a navigation menu link list made from a vertical <ultag. I have a piece of javascript that grabs the title attribute of each link in the list and displays it as a <span> inside the link. I am using a bit of CSS to attempt to make it so that this <spanonly displays on mouseover. This bit working great in Mozilla but not at all in IE6. What I am trying to figure out (aside form how to make this work in...
0
1544
by: Nik Coughlin | last post by:
If you have an absolutely positioned element and you place an absolutely positioned child element within it and give the child values for both top and bottom the child will have zero height (expected behavior is has same height as parent less top + bottom): http://nrkn.com/opera9Bug/min/ How to reproduce: Create a block element with position relative. Let's call it grandparent.
2
1413
by: fjohnson | last post by:
Hello, I have a CSS Horizontal dropdown menu and the drop down menu is pushed to the right instead of directly underneath the heading. I am completely new to CSS and I do not yet know exactly what I am looking at in the CSS file. Any idea on how I can get it positioned correctly? Coding as follows: CSS style sheet: -------------------------------------------------------- /* Begin CSS Drop Down Menu */ #menu { width: 100%;
0
8203
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8642
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...
1
8368
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8512
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...
0
5576
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4094
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
4206
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1515
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.