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

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

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

댓글 작성

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

로그인하기

게시글 목록

번호 제목
20097
20095
20093
20092
20091
20089
20086
20085
20084
20083
20082
28358
20081
20079
20078
20077
20076
20075
20074
20073
20072
20071
20070
20069
8148
20057
8141
24669
20056
8138
28353
20055
20054
20053
20052
20051
20050
20047
20046
20045
20044
8111
20043
20042
20040
20039
20037
20036
20035
20027
8107
31022
20026
20025
20024
20023
28350
20022
20018
20017
8099
20016
20013
8090
20012
20010
20009
19998
28348
28347
19997
19996
19995
19993
8087
8065
19990
8063
8056
19989
19988
19987
19986
19985
19984
19983
19982
8054
19981
19980
19979
19978
19977
19976
19975
19974
19973
19972
19971
19970