3dmap-master/js/utm-converter/src/converter.js
/*
  * btnToUTM_OnClick
  *
  * Called when the btnToUTM button is clicked.
  *
  */
btnToUTM_OnClick
Called when the btnToUTM button is clicked.
btnToUTM_OnClick Called when the btnToUTM button is clicked .
function btnToUTM_OnClick ()
  {
      var xy = new Array(2);
      if (isNaN (parseFloat (document.frmConverter.txtLongitude.value))) {
          alert ("Please enter a valid longitude in the lon field.");
          return false;
      }
      lon = parseFloat (document.frmConverter.txtLongitude.value);
      if ((lon < -180.0) || (180.0 <= lon)) {
          alert ("The longitude you entered is out of range.  " +
                 "Please enter a number in the range [-180, 180).");
          return false;
      }
      if (isNaN (parseFloat (document.frmConverter.txtLatitude.value))) {
          alert ("Please enter a valid latitude in the lat field.");
          return false;
      }
      lat = parseFloat (document.frmConverter.txtLatitude.value);
      if ((lat < -90.0) || (90.0 < lat)) {
          alert ("The latitude you entered is out of range.  " +
                 "Please enter a number in the range [-90, 90].");
          return false;
      }
      zone = Math.floor ((lon + 180.0) / 6) + 1;
      zone = LatLonToUTMXY (DegToRad (lat), DegToRad (lon), zone, xy);
      document.frmConverter.txtX.value = xy[0];
      document.frmConverter.txtY.value = xy[1];
      document.frmConverter.txtZone.value = zone;
      if (lat < 0)
          document.frmConverter.rbtnHemisphere[1].checked = true;
      else
          document.frmConverter.rbtnHemisphere[0].checked = true;
      return true;
  }
function btnToUTM_OnClick ( ) { var xy = new Array ( 2 ) ; if ( isNaN ( parseFloat ( document . frmConverter . txtLongitude . value ) ) ) { alert ( "Please enter a valid longitude in the lon field." ) ; return false ; } lon = parseFloat ( document . frmConverter . txtLongitude . value ) ; if ( ( lon < - 180.0 ) || ( 180.0 <= lon ) ) { alert ( "The longitude you entered is out of range.  " + "Please enter a number in the range [-180, 180)." ) ; return false ; } if ( isNaN ( parseFloat ( document . frmConverter . txtLatitude . value ) ) ) { alert ( "Please enter a valid latitude in the lat field." ) ; return false ; } lat = parseFloat ( document . frmConverter . txtLatitude . value ) ; if ( ( lat < - 90.0 ) || ( 90.0 < lat ) ) { alert ( "The latitude you entered is out of range.  " + "Please enter a number in the range [-90, 90]." ) ; return false ; } zone = Math . floor ( ( lon + 180.0 ) / 6 ) + 1 ; zone = LatLonToUTMXY ( DegToRad ( lat ) , DegToRad ( lon ) , zone , xy ) ; document . frmConverter . txtX . value = xy [ 0 ] ; document . frmConverter . txtY . value = xy [ 1 ] ; document . frmConverter . txtZone . value = zone ; if ( lat < 0 ) document . frmConverter . rbtnHemisphere [ 1 ] . checked = true ; else document . frmConverter . rbtnHemisphere [ 0 ] . checked = true ; return true ; }
btnToUTM_OnClick
 Called when the btnToUTM button is clicked.
btnToUTM_OnClick Called when the btnToUTM button is clicked .
// Compute the UTM zone. /* Set the output controls.  */ // Set the S button. // Set the N button.