I know - I came across that one - this was my fix.
With no intellisense jscript can be a pain, I have examples in mybook that
simply do not hold true for NN or ie - dunno who wrote it they must have
guessed at half of it - or MS have altered IE over time, and altered
existing models not just added stuff to them.
Anyway
function WeirdFunction(){
//Check this out peeps
//Luckily for me it just so happened that I was subtracting in OpenWin()
//Look ::
var item = document.images.im;
var locW = 0;
locW = item.style.left.substring(0,item.style.left.length-2); // all I could
think to do to rid me of the px on the end.
var totaddition = 0;
var totsubtraction = 0;
var totdoubleneg = 0;
var totaddition = locW + 7 ;
var totsubtraction = locW - 7;
var totdoubleneg = locW - (-7);
alert("totaddition is:" + totaddition + " totsubtraction is:" +
totsubtraction + " totdoubleneg is:" + totdoubleneg);
}
If locW was 40px then the above alert displays 407 for the addition, then
33, then 47.
The proper way is :
function getTopPos(el) {
if (ie5) {
if (el.currentStyle.top == "auto")
return 0;
else
return parseInt(el.currentStyle.top);
}
else {
return el.style.pixelTop;
}
}