Web Analytics Made Easy -
StatCounter Hi all, i 've got a problem with CSS... - CodingForum

Announcement

Collapse
No announcement yet.

Hi all, i 've got a problem with CSS...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hi all, i 've got a problem with CSS...

    Hi all, this my problem is: how can i get the X,Y coordinate of the layer which has position relative to other object.
    for example :
    ----------------
    <Html>
    <BODY>
    <script>
    function MOut(t)
    {
    if(t!="")
    it=document.getElementById(t);
    alert(it.event.clientX);//this line is my idea, i know it's not run, but i put here

    }
    </script>
    <Div id="l1" style="position:absolute;width :30px;height:150px;top:0px;left:0px;z-index:1;background-color:blue" ></DIV>
    <Div id="l2" style ="position:relative;width :20px;height:30px;top:- 50px;left:5px;z-index:3;background-color:red" onmouseout ="MOut('l2')"></DIV>
    </BODY>

    </html>
    ---------------
    The function MOut is not run, but i put in the code to explain my idea.
    if I use function : window.event.clientX; but this Func only return the X,Y coordinate relative to window...
    Help me to solve this problem, Thanks to all!

  • #2
    Well first of all the l2 in this situation is not relative to l1, if you wanted it to be you could put the div within the other div like <div ...><div...></div></div>. Also your css for the divs are messed up, you have spaces were they don't belong, like
    top:- 50px; you should not have a space in between the - and the 50, also were you have onmouseout ="MOut('l2')" that space does not belong. There are some other spaces that do not belong but don't matter as much.

    ps. this doesnt belong in this forum, it belongs in the HTML and CSS forum!
    Last edited by kwhubby; Feb 16, 2004, 01:46 AM.
    Kris Hubby
    kwhubby site

    Comment

    Working...
    X