DIV dynamic positioning


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: DIV dynamic positioning

  1. #1
    P-Dog Guest

    DIV dynamic positioning


    Hi, I've been having trouble trying to dynamically position DIV layers on
    the page.

    Let's say I want to place the layer the (screen height) / 2 down the screen.
    So if my screen res is 640x480, it will place the layer object at 240 pixels
    down the screen, and if the screen res is 800x600, it will place the layer
    300 pixels down the screen.

    Getting screen res is no problem. Doing dynamic positioning is what is bothering
    me

    What I did at first (but it didn't work) was I made a javascript init() function
    that takes the DIV ID and adjusts the height, and this would be run when
    the page loads. However, this didn't work, as nothing was set in the correct
    position at all. There was another method which involved using the document.writeout
    function, but I don't want to use any document.writeOut functions either.
    So can anyone give me advice on this? Thanks

  2. #2
    Q*bert Guest

    Re: DIV dynamic positioning


    Tables?
    being able to control the cells, thier height and width and where data appears
    in them might solve your problem.

    "P-Dog" <project_gayo_history@hotmail.com> wrote:
    >
    >Hi, I've been having trouble trying to dynamically position DIV layers on
    >the page.
    >
    >Let's say I want to place the layer the (screen height) / 2 down the screen.
    > So if my screen res is 640x480, it will place the layer object at 240 pixels
    >down the screen, and if the screen res is 800x600, it will place the layer
    >300 pixels down the screen.
    >
    >Getting screen res is no problem. Doing dynamic positioning is what is

    bothering
    >me
    >
    >What I did at first (but it didn't work) was I made a javascript init()

    function
    >that takes the DIV ID and adjusts the height, and this would be run when
    >the page loads. However, this didn't work, as nothing was set in the correct
    >position at all. There was another method which involved using the document.writeout
    >function, but I don't want to use any document.writeOut functions either.
    > So can anyone give me advice on this? Thanks



  3. #3
    Herries Guest

    Re: DIV dynamic positioning


    Hi,

    How do you captured the display resolution ??

    Thank you,

    Herries

    "P-Dog" <project_gayo_history@hotmail.com> wrote:
    >
    >Hi, I've been having trouble trying to dynamically position DIV layers on
    >the page.
    >
    >Let's say I want to place the layer the (screen height) / 2 down the screen.
    > So if my screen res is 640x480, it will place the layer object at 240 pixels
    >down the screen, and if the screen res is 800x600, it will place the layer
    >300 pixels down the screen.
    >
    >Getting screen res is no problem. Doing dynamic positioning is what is

    bothering
    >me
    >
    >What I did at first (but it didn't work) was I made a javascript init()

    function
    >that takes the DIV ID and adjusts the height, and this would be run when
    >the page loads. However, this didn't work, as nothing was set in the correct
    >position at all. There was another method which involved using the document.writeout
    >function, but I don't want to use any document.writeOut functions either.
    > So can anyone give me advice on this? Thanks



  4. #4
    Q*bert Guest

    Re: DIV dynamic positioning


    In these cases I wouldn't I'd use %'s for position, that way it adjusts when
    the user has different resolutions.
    "Herries" <herries_e@yahoo.com> wrote:
    >
    >Hi,
    >
    >How do you captured the display resolution ??
    >
    >Thank you,
    >
    >Herries
    >
    >"P-Dog" <project_gayo_history@hotmail.com> wrote:
    >>
    >>Hi, I've been having trouble trying to dynamically position DIV layers

    on
    >>the page.
    >>
    >>Let's say I want to place the layer the (screen height) / 2 down the screen.
    >> So if my screen res is 640x480, it will place the layer object at 240

    pixels
    >>down the screen, and if the screen res is 800x600, it will place the layer
    >>300 pixels down the screen.
    >>
    >>Getting screen res is no problem. Doing dynamic positioning is what is

    >bothering
    >>me
    >>
    >>What I did at first (but it didn't work) was I made a javascript init()

    >function
    >>that takes the DIV ID and adjusts the height, and this would be run when
    >>the page loads. However, this didn't work, as nothing was set in the correct
    >>position at all. There was another method which involved using the document.writeout
    >>function, but I don't want to use any document.writeOut functions either.
    >> So can anyone give me advice on this? Thanks

    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center