// ArcGIS server9.3 ADF Javascript
VaR scale = "";
If (Map. _ extent! = NULL)
{
// Obtain the coordinates of the MAP range in the current field of view
VaR Maxx = map. _ extent. _ xmax;
VaR Minx = map. _ extent. _ xmin;
VaR Maxy = map. _ extent. _ Ymax;
VaR miny = map. _ extent. _ ymin;
// Width and height of the map control (image)
VaR imagewidth = map. _ mapsize [0];
VaR imageheight = map. _ mapsize [1];
// Map coordinates of the current map's field of view Center
VaR centerpoint = map. get_center ();
VaR centerx = centerpoint. Coordinates [0];
VaR centery = centerpoint. Coordinates [1];
// DPI of the current screen (points per inch)
VaR DPI = 96;
// Number of points on the current screen in meters
VaR dots_per_m = DPI/2.54*100;
// The width of the map control is half (in meters)
VaR width_size_in_m = (imagewidth/2)/dots_per_m;
Scale = (Maxx-centerx)/width_size_in_m;
}