MDN111
-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by MDN111
-
-
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.
Why do I fail to retrieve a property value with js ?
in JavaScript
Posted