Problem positioning a layer, please advise.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Question

    #1

    Problem positioning a layer, please advise.

    I am making a custom small menu which is most basic. Problem is that I can't
    make the first step work for some reason.

    I have an image to the left of where would be the layer positioned. This
    layer must be 15 pixels to the left of that image.

    Since my main page is centered in the browser's window, the pixels to the
    left of my image are different for each browser and also depends on how wide
    the browser window is.

    This is my stupid code that has a function that is called in BODY onload:
    <SCRIPT LANGUAGE="JavaS cript">function PosLayer() {
    pic=document.ge tElementById("P icture");
    layer=document. getElementById( "Layer");
    layer.style.lef t=parseInt(pic. style.left) + 15; }</script>Someone said that
    image has no ".style.lef t" property, I don't know if it is true.If it is,
    how would I go about positioning the layer where I want relative to some
    other object?Thank you very much, somehow my books on Java script don't
    describe this well. Please advise me, thank you again.


  • JimMenees

    #2
    Re: Problem positioning a layer, please advise.

    you can do this using css; make your image positioned RELATIVE to your layer;
    you'll need to align your html elements the right way.
    <div id="layer">
    layer stuff here
    <div id="image"><im g src </div
    </div>

    Then set the left: ; and top: ; coordinates accordingly. email me with a
    url and i'll take a peek at it and see if it's doable.

    Jim

    Comment

    Working...