By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,963 Members | 1,841 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,963 IT Pros & Developers. It's quick & easy.

Problem positioning a layer, please advise.

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.