浏览器获取地理位置信息:
if( navigator.geolocation){
navigator.geolocation.getCurrentPosition(
function(position){
alert("your position : ["+position.coords.latitude+","+position.coords.longitude+"]");
},
function(error){
alert('[' + error.code + '] ' + error.message);
},
{enableHighAccuracy:true,maximumAge:600000}
);
}
动态加载css :
if(document.createStyleSheet){
document.createStyleSheet(url);
}else{
var css = document.createElement('link');
css.setAttribute('href', url);
css.setAttribute('rel', 'stylesheet');
css.setAttribute('type', 'text/css');
document.body.getElementsByTagName("head")[0].appendChild(css);
}
ajax获取服务器时间:
var severtime=new Date(xmlRequest.getResponseHeader("Date"));
severtime = severtime.getTime();