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

· 2014-04-13 (일) 00:34:56 · 4799
 
모바일에서 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,049
16-07-12 조회 2,179
16-07-12 조회 2,201
16-07-11 조회 2,092
16-06-05 조회 2,639
16-06-03 조회 2,739
16-05-26 조회 2,696
15-09-22 조회 4,831
15-06-10 조회 4,581
14-10-25 조회 6,034
14-10-22 조회 8,778
14-09-21 조회 5,585
14-09-16 조회 4,895
14-08-22 조회 1만
14-08-13 조회 5,716
14-08-12 조회 5,256
14-08-12 조회 6,141
14-08-11 조회 6,626
14-06-12 조회 5,969
14-06-11 조회 4,809
14-05-09 조회 5,201
14-05-09 조회 6,185
14-05-09 조회 6,189
14-05-08 조회 5,562
14-04-17 조회 4,487
14-04-16 조회 4,366
14-04-15 조회 4,330
14-04-15 조회 4,379
14-04-15 조회 4,027
14-04-14 조회 4,062
14-04-14 조회 4,031
14-04-14 조회 4,451
14-04-14 조회 4,487
14-04-14 조회 4,506
14-04-13 조회 4,367
14-04-12 조회 4,092
14-04-12 조회 4,113
14-04-12 조회 4,209
14-04-11 조회 4,715
14-04-10 조회 4,434
14-04-10 조회 4,466
14-04-09 조회 4,688
14-04-09 조회 5,024
14-04-08 조회 6,667
13-10-30 조회 7,458
13-07-11 조회 4,972
13-03-28 조회 1.1만
13-02-27 조회 6,507
13-02-14 조회 5,392
13-01-10 조회 4,389
12-12-31 조회 4,917
12-12-20 조회 6,017
12-12-12 조회 5,157
12-12-07 조회 4,325
12-11-28 조회 4,650
12-11-22 조회 5,102
12-11-12 조회 5,402
12-09-22 조회 4,419
12-09-18 조회 4,608