Jump to content

MDN111

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by MDN111

  1. Hello again,
    Many thanks to justsomeguy and Hadien for the reply.
    Although I find it a rather weird behavior, I now understand what's happening.
    To solve my problem (which is to calculate the left en top of a popup-div on the basis of its width and height), I defined the properties inline in the div tag.
    It works in IE, FF and Chrome.
    Thanks again.
    Grtz,
    MDN111.
  2. Hello !
    Here is my question:
    I'm going to the HTML DOM Style Object chapter on http://www.w3schools.com/ en click on the property "left" and choose "Try it yourself". That leads me to http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_style_left . It is a code to shift a button 100px to the left. It works fine and I understand it. So far, so good.
    Now I modify two lines of the code:
    Firstly, in the style block, I add the property "left" and assign to it a value of "300px".
    Secondly, I rule out the line "document.getElementById("b1").style.left="100px";" and replace it by "alert(document.getElementById("b1").style.left)".
    See the joined screenshot.
    In fact, all I want to do is to retrieve the value of the left-property and show it in the alert-box. I expect that the alert-box would display "300px" but it does not !!! The message of the alert-box is a null string (???).
    What is wrong with my way of thinking ?
    Grtz,
    MDN111.

    post-168808-0-80840100-1386086658_thumb.png

×
×
  • Create New...