danhall
06-05-2007, 11:06 AM
Hi All
The problem i have is when i grab an elements style value it brings back the integer value '1' in IE but the string '1px' in FF. This gives a problem when i need to use the value in an IF statement as i only interpret '1' as an integer and not '1px' as a string.
The code:
var positionTop = document.getElementById("<?php echo $currentdiv ?>");
var thisTop = (document.all)? positionTop.offsetTop : document.defaultView.getComputedStyle(positionTop, "").getPropertyValue("top");
My question is can you use any other method similar to the above that brings back the integer value only without the 'px' in FF (not concat) ;)
Thanks in advance.
The problem i have is when i grab an elements style value it brings back the integer value '1' in IE but the string '1px' in FF. This gives a problem when i need to use the value in an IF statement as i only interpret '1' as an integer and not '1px' as a string.
The code:
var positionTop = document.getElementById("<?php echo $currentdiv ?>");
var thisTop = (document.all)? positionTop.offsetTop : document.defaultView.getComputedStyle(positionTop, "").getPropertyValue("top");
My question is can you use any other method similar to the above that brings back the integer value only without the 'px' in FF (not concat) ;)
Thanks in advance.