一个简单的css属性获取函数
作者:Rekey 发布时间:August 31, 2009 分类:Develop
粉简单的代码。自己记录下
javascript代码:
function getStyle(o, a){
return o.style[a] ? o.style[a] : window.getComputedStyle ? window.getComputedStyle(o, null)[a] : o.currentStyle[a];
}
function $(id){
return document.getElementById(id);
}
高度,这个无法正确获得.我说的意思的前提你不要给div一个固定的值
这个函数只获取css属性.不对真实高度做检测.呵呵