테스트 사이트 - 개발 중인 베타 버전입니다

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

· 11년 전 · 1934
 
모바일에서 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>

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

게시글 목록

번호 제목
5638
27321
5637
31931
31925
18979
5633
27316
27307
18976
5631
18974
31919
30803
31911
5625
5623
5620
27298
31904
31887
31884
18967
5616
5611
18963
5608
31881
5601
31866
31862
5599
5595
5592
24497
18958
31859
31855
18952
18946
18942
18939
18936
18933
5590
5586
18924
18915
18913
18908
27293
5583
5580
18895
18886
18880
5576
31840
30792
18869
18866
18862
18858
5569
5565
27287
18857
18855
18854
18847
18843
18841
18840
31825
18839
18835
18833
18832
18822
18820
5561
31806
18815
31830
18809
18807
18806
18803
18801
18800
18796
5559
18793
18791
5554
31780
31790
31758
24491
27284