469,600 Members | 2,367 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,600 developers. It's quick & easy.

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="JavaScript">function PosLayer() {
pic=document.getElementById("Picture");
layer=document.getElementById("Layer");
layer.style.left=parseInt(pic.style.left) + 15; }</script>Someone said that
image has no ".style.left" 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.
Jul 20 '05 #1
1 1368
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"><img 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
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Jerry | last post: by
4 posts views Thread by JesusFreak | last post: by
8 posts views Thread by rdlebreton | last post: by
4 posts views Thread by Richard | last post: by
2 posts views Thread by TheCruelPanda | last post: by
3 posts views Thread by vunet | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.