Something like this should do this:
function getStyle(el, prop) {
var doc = el.ownerDocument, view = doc.defaultView;
if (view && view.getComputedStyle) {
return view.getComputedStyle(el, '')[prop];
}
return el.currentStyle[prop];
}
var all = document.getElementsByTagName('*'), i = all.length;
while (i--) {
var topOffset = parseInt(all[i].style.top, 10);
if (getStyle(all[i], 'position') === 'absolute') {
all[i].style.top = isNaN(topOffset) ? '155px' : (topOffset + 155) + 'px';
}
}
source
share