function success(position){
alert("获取位置成功",position.coords);
document.write("维度",position.coords.latitude,"经度",position.coords.longitude,"坐标精度",position.coords.accuracy)
}
function error(positionError){alert('获取位置失败:',positionError.code,positionError.Message)
document.write(positionError.code,positionError.Message)
}
var options = {
enableHighaccuracy:false,
timeout:3000,
maximumAge:0
}
if(navigator.geolocation){console.log("支持定位")
navigator.geolocation.getCurrentPosition(success,error,options)
}else{alert("不支持定位")
}