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

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

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

댓글 작성

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

로그인하기

게시글 목록

번호 제목
6615
6614
6606
19438
6604
6592
6588
6586
6583
6577
19437
6576
6575
6574
19435
27715
6571
6570
6562
6559
6553
6552
6551
6548
24572
6545
6544
6543
6541
6539
6527
6526
6524
6519
6516
27701
27699
6515
19434
6514
19433
6503
19432
6500
6497
6496
6491
6485
32041
6483
6479
6478
6475
6473
6467
6465
6462
27697
6454
6451
27695
6446
6440
6437
27688
6433
6430
6427
6426
6422
6421
6418
27686
27678
6414
6410
6404
6400
6398
6389
6384
6383
6378
6370
6363
6348
6338
6329
6328
6316
6309
6299
6296
27674
27671
6293
6282
24570
6277
6264