Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Apr 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Getting an object position to set a window.open position

    Hi Dudes, i'm experiencing some problems to manage this...

    i managed to get the object position through a div( or span)
    now what i want is to set the position of the window.open, like..

    i got a image(object) with known position, now i want to open below this object the window.open(a small window popup)

    ps : the resolution of the user doesnt matter. always have to appear below the object.

    if i failed making myself clear, ask me for more info about the problem.


    thanks dudes.

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    now i want to open below this object the window.open
    You can not open a new window below an opener's object...
    Last edited by Kor; 04-13-2005 at 05:36 PM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New to the CF scene
    Join Date
    Apr 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hey Kor...

    what i want is when the window.open is executed, the opened window opens right there.. below the object ...

    what i have is a field with an image in its rightside , and when i click this image it opens a popup window with a calendar, but i want this calendar to be open below the field and the userīs resolution shouldnt be a problem.

    i can open the popup window if i know the userīs resolution, i could set a function that would verify that, and depending on its value the function could calculate where to put the popup window. but i want something that i shouldnt care for userīs interface... the popup window should be always there... just below the field that receives the DATE

    thanks..

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    aha.I got it.

    To get the real absolute postion of an object (your field), you may use this short code:
    PHP Code:
    var x;var y
    function getPosition(obj){
    x=obj.offsetLeft;
    y=obj.offsetTop;
    while(
    obj.offsetParent){
    if(
    obj==document.getElementsByTagName('body')[0]){break;}
    else{
    x=x+obj.offsetParent.offsetLeft;
    y=y+obj.offsetParent.offsetTop;
    obj=obj.offsetParent;
    }
    }

    Now you can open the pop-up according to the values x and y. You don't need to know the user's monitor resolution.

    Note. If you have tables, and the align of them is set by "center" HTML attribute, maybe it would be safer to build it in a full mode, at least with <tbody>

    <table>
    <tbody>
    <tr>
    <td>
    ...
    ...
    </td>
    </tr>
    </tbody>
    </table>

    as Mozilla might rather consider the tbody's position as parent that the "unknown" table's position.
    Last edited by Kor; 04-14-2005 at 10:03 AM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #5
    New to the CF scene
    Join Date
    Apr 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    this code u passed me Kor, would work in this case:

    imaging the default userīs resolution as 1024x768
    but when he opens the database( i work with Lotus Notes) through a web browser( the application im doing is for web) , it will open as 1024x768.. but if the user "Restore down", change the resolutionīs value. will the calendar open below the field anyway?

    i want to set this calendar below the DATE field in all userīs choices of how he uses his IE or NS ( talking about on Resize window event)

    i will test your code . thanks.

  • #6
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    I don't quite get it...
    change the resolutionīs value
    Why user should change the resolution during the sesion? As a web designer I do that quite often to verify a page on different resolutions, and this bothers me enough... Why should a simple user change it's resolution? And, anyway... The resolution has nothing to do with the object's position. Nomatter the resolution, an object is placed at the same number of pixels left/top starting from the left/top 0 corner of the page
    Last edited by Kor; 04-14-2005 at 04:32 PM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •