Hi,

I'll start by saying I'm a complete newbie, this is the first time I

have used Javascript.

The code below I have written to calculate distance/bearings and times

from a grid reference.

It works absolutely fine in Opera 7.11, but in IE it throws up an

"object doesn't support this operation or method" error.

Any help/suggestions to where I have gone wrong and how I can get this

working in IE would be greatly appreciated.

Cheers Si,

###############CODE###################

function distance(form) {

var x1 = eval(form.x1.value);

var y1 = eval(form.y1.value);

var x2 = eval(form.x2.value);

var y2 = eval(form.y2.value);

var sd = eval(form.s.value);

var xdiff = x2 - x1;

var ydiff = y2 - y1;

var y = Math.pow((xdiff * xdiff + ydiff * ydiff), 0.5)/10;

if (Math.atan2((y2 - y1),-(x2 - x1)) * (180 / Math.PI) - 90 < 0) {

var b = Math.atan2((y2 - y1),-(x2 - x1)) * (180 / Math.PI) + 270;

}

else {

var b = Math.atan2((y2 - y1),-(x2 - x1)) * (180 / Math.PI) - 90;

}

var t = y / sd;

form.distance.value = Math.round(10*y)/10

form.time.value = (Math.round(10*t)/10)*60

form.bear.value = Math.round(b)

}

###########################################