GPS정보 모바일에서 사용하기

· 2014-04-13 (일) 00:34:56 · 4800
 
모바일에서 GPS가져오는 파일입니다.
유용하게 사용하세요 안되시면 쪽지주세요..
구글플레이안산놀이터에 적용된 파일입니다.
 
 
<!DOCTYPE html>
<html>
 <head>
  <title>jQuery Mobile</title>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> 
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> 
<script type='text/javascript' src='/js/jquery-1.7.2.min.js'></script>
<script type='text/javascript' src='/js/jquery.common.js'></script>
<script type='text/javascript' src='/js/swipe.js'></script>
  <meta charset="utf-8" />
  <script>
    var geocoder = new google.maps.Geocoder();
    var addr = "";
   if( navigator.geolocation )
   {
    //괄호 속 인자 ( 성공일 때 함수명, 실패일 때 함수명)
    navigator.geolocation.getCurrentPosition( showPosition, handleError );
   }
   else
   {
    alert('navigator.geolocation 브라우저 미지원');
   }
   function showPosition( position )
   {
    //alert( '위도 : '+position.coords.latitude + '\n경도 : ' + position.coords.longitude );
    googl(position.coords.latitude,position.coords.longitude);
   }
   function handleError( evt )
   {
    alert( evt.message );
   }   
    function googl(num1, num2){
      var latlng = new google.maps.LatLng(num1, num2); 
     
      geocoder.geocode({'latLng': latlng}, function(results, status){
 
     if( status == google.maps.GeocoderStatus.OK ) { 
      //alert(results[0].formatted_address);
  
    //  document.write(results[1].formatted_address);
    //$("#add1").value('111');//results[1].formatted_address); 
    document.body.innerHTML = results[1].formatted_address;
   } 
   else { 
    //document.write("Geocoder failed due to: " + status)
    document.body.innerHTML += "Geocoder failed due to: " + status + "<br />";
    //$("#address").html("Geocoder failed due to: " + status);; 
   } 
  });
}
</script>
</head>
<body>
<!-- <div id="add1" style="font-size:13px;"></div> -->
</body>
</html>

첨부파일

gps.html (1.9 KB) 36회 2014-04-13 00:34
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,188건
+
제목 글쓴이 날짜 조회
16-07-13 조회 2,050
16-07-12 조회 2,179
16-07-12 조회 2,204
16-07-11 조회 2,092
16-06-05 조회 2,640
16-06-03 조회 2,741
16-05-26 조회 2,699
15-09-22 조회 4,833
15-06-10 조회 4,584
14-10-25 조회 6,037
14-10-22 조회 8,781
14-09-21 조회 5,587
14-09-16 조회 4,895
14-08-22 조회 1만
14-08-13 조회 5,722
14-08-12 조회 5,258
14-08-12 조회 6,141
14-08-11 조회 6,633
14-06-12 조회 5,971
14-06-11 조회 4,813
14-05-09 조회 5,203
14-05-09 조회 6,188
14-05-09 조회 6,190
14-05-08 조회 5,563
14-04-17 조회 4,492
14-04-16 조회 4,370
14-04-15 조회 4,332
14-04-15 조회 4,382
14-04-15 조회 4,028
14-04-14 조회 4,067
14-04-14 조회 4,035
14-04-14 조회 4,455
14-04-14 조회 4,488
14-04-14 조회 4,508
14-04-13 조회 4,369
14-04-12 조회 4,092
14-04-12 조회 4,116
14-04-12 조회 4,214
14-04-11 조회 4,722
14-04-10 조회 4,437
14-04-10 조회 4,468
14-04-09 조회 4,692
14-04-09 조회 5,027
14-04-08 조회 6,669
13-10-30 조회 7,463
13-07-11 조회 4,973
13-03-28 조회 1.1만
13-02-27 조회 6,509
13-02-14 조회 5,393
13-01-10 조회 4,391
12-12-31 조회 4,918
12-12-20 조회 6,018
12-12-12 조회 5,157
12-12-07 조회 4,327
12-11-28 조회 4,652
12-11-22 조회 5,102
12-11-12 조회 5,406
12-09-22 조회 4,419
12-09-18 조회 4,609