开发者

JavaScript $('myDiv').style.direction always returns blank?

I'm trying to get the direction property for the element. I have this code:

document.write('<div style="position: absolute; display: none;" id="menuDiv"></div>');

And in my .css file I have:

#menuDiv {
    direction: rtl;
}

Then, using prototype, I'm trying to query the direction for that div:

alert( $('menuDiv').style.direction );

But for some reason I'm always getting blank, ne开发者_运维知识库ver an 'rtl' value which I need to find out whether current style is left-to-right or not so that the menu can be positioned properly.

Thanks!


Try using $('menuDiv').getStyle('direction'). The element's "style" property may not contain the style as applied by the stylesheet.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜