首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

技术札记

2012-09-10 
技术笔记浏览器获取地理位置信息:??? if( navigator.geolocation){??? ??? navigator.geolocation.getCurr

技术笔记

浏览器获取地理位置信息:

??? 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();

热点排行