why javascript this.style[property] return an empty string? [duplicate]

Solution 1:

The .style property is for getting styles that were placed directly on the element. It doesn't compute styles from your stylesheets.

See getComputedStyle().

Solution 2:

The elements do not have a CSS height or width specified.

Note that you are trying to get the "requested" sizes, not the actual sizes. The output therefore is correct.

If you want to get the effective sizes, use the jQuery width() and height() methods. See http://api.jquery.com/width/