js在IE下获取background-position的问题

通过 mootools 获取 background-position 的值时,在 IE 中返回 undefined
通过测试,发现无论是写在样式表中,还是写在元素style属性里,在 IE ( 6, 7, 8 ) 里获取background-position的值时,均返回undefined。

自己增加了mootools 的扩展

1 Element.implement({
2 getBackgroundPosition : function() {
3 if (Browser.Engine.trident) {
4 return this.getStyle('backgroundPositionX') + ' ' + this.getStyle('backgroundPositionY');
5 } else {
6 return this.getStyle('backgroundPosition');
7 }
8 }
9 })
posted @ 2011-05-27 10:55  oneroundseven  阅读(1365)  评论(0编辑  收藏  举报