您的位置:首页 > Web前端 > HTML5

h5 新标签 ——LBS 属性

2017-02-14 15:41 246 查看
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<div id="lbs">
</div>
<button onclick="getLBS()">获取我的位置</button>
<script type="text/javascript">
function getLBS(){
if(navigator.geolocation)
//          navigator.geolocation.getCurrentPosition(showPosition);
navigator.geolocation.watchPosition(successCallback,errorCallback,options);
else
alert("不支持LBS");
}

function showPosition(p){
var str ="你的坐标:维度" + p.coords.latitude + ";经度" +p.coords.longitude;

document.getElementById("lbs").innerHTML = str;
}
</script>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  h5 新特性