基本信息
源码名称:php 手机根据网页ip进行地理位置 定位
源码大小:0.03M
文件格式:.rar
开发语言:PHP
更新时间:2017-09-16
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 1 元×
微信扫码支付:1 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<script src="js/jquery-1.11.2.min.js"></script>
<title>定位</title>
</head>
<script language="javascript">
//定位成功函数
function getPositionSuccess(position){
if(position && window.sessionStorage)
{
var lat = position.coords.latitude;
var lng = position.coords.longitude;
alert(lat "|" lng)
var arrayObj = new Array(lat,lng);
$.ajax({url:"chuli.php",type: "POST",data: {'arrayObj':arrayObj},
success:function(result){
a=result.split('|');
alert("提交成功" a[0] a[1] a[2] a[3]);
}});
}
}
//定位失败函数
function getPositionError(error){
switch(error.code){
case error.TIMEOUT:
alert("连接超时,请重试");
break;
case error.PERMISSION_DENIED:
alert("您拒绝了使用位置共享服务,查询已取消");
break;
case error.POSITION_UNAVAILABLE:
alert("亲爱的火星网友,非常抱歉,我们暂时无法为您所在的星球提供位置服务");
break;
}
}
//定位开始,去掉一切提示,定位不上直接存空
if(navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(getPositionSuccess, getPositionError);
}
else
{
//alert("您的浏览器不支持Geolocation!");
}
</script>
<body></body></html>