For some reason in Internet Explorer 8 (and probably 7) the follow section of code doesn’t wok, any ideas?
var middlelatlong = bounds.getCenter();
//when alerted middlelatlong = (51.65494320798432,0.5499464196260533);
var x = 0;
var keys = new Array();
for(var key in middlelatlong){
if(x <= 1){
keys[x] = key;
}
x++;
}
var southlong = middlelatlong[keys[0]]-0.00017;
Returns NaN in Internet Explorer 8 but in all other browsers it equals 51.654790472326724.
I don’t know what you are tying to achieve with your code, but I assume that
middlelatlong[keys[0]]returns something which is not a number.It seems that you are using the Google Maps API and that you want to access the latitude part of the coordinates. You should read the document properly and use the API to access the information instead of your own try to extract the information.
If
getCenterrefers to the method described here, then it returns aLatLngobject. You can access the latitude withlat()then (or if you want the longitude, uselng()):Your problem is that you are making assumptions about the order in which the properties of an object are traversed, but this order is not defined, this is implementation dependent. So you cannot say that the first two properties will be the coordinates, the object has other properties as well, which might be traversed first in IE.