我正在用php和html-5开发一个网站,我的计划是在给定的JPEG图像上显示两个位置之间的动态路径,我们如何才能做到这一点,我不知道如何使用GPS系统与网站,我需要一些帮助。
谢谢
发布于 2012-10-19 16:03:35
这里有一篇不错的文章:
http://merged.ca/iphone/html5-geolocation
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
function (position) {
// Did we get the position correctly?
// alert (position.coords.latitude);
// To see everything available in the position.coords array:
// for (key in position.coords) {alert(key)}
alert(position.coords.latitude + ',' + position.coords.longitude);
},
// next function is the error callback
function (error)
{
switch(error.code)
{
case error.TIMEOUT:
alert ('Timeout');
break;
case error.POSITION_UNAVAILABLE:
alert ('Position unavailable');
break;
case error.PERMISSION_DENIED:
alert ('Permission denied');
break;
case error.UNKNOWN_ERROR:
alert ('Unknown error');
break;
}
}
);
}}
发布于 2012-10-19 15:51:15
查看这篇W3Schools文章:http://www.w3schools.com/html/html5_geolocation.asp
if(!navigator.geolocation){
//the browser does not support geolocation
}else{
(function getPosition(){
navigator.geolocation.getCurrentPosition(
function (position){
//use the coordinates
balloon.style.left = (position.coords.latitude - latMin) * latScale;
balloon.style.top = (position.coords.longitude - longMin) * longScale;
//requery the position after a set time
setTimeout(getPosition,1000);
}
)
})()
}https://stackoverflow.com/questions/12969425
复制相似问题