//博客统计类 var Counter = { nodeID : null, //博客id,必须提供,否则统计不会进行统计 engineURL : [[".google.","谷歌","q"],[".baidu.","百度","wd"],[".soso.","搜搜","w"]], //搜索引擎的URL countType : "site", counterURL : "../../counter", //统计servlet的url ajax : null, url : null, id : null, source : null, //浏览器地址栏的上一个地址 clientScreen : null,//显示器分辨率 clientColor : null,//显示器颜色 clientAgent : null,//浏览器信息 clientOS : null,//操作系统 clientLanguage : null,//操作系统语言 engineSource : null, //搜索引擎 engineKey : null, //搜索的关键字 //设置blogID setNodeID:function(id){ Counter.nodeID = id; }, setType:function(type){ Counter.countType = type; }, setCounterURL:function(url){ Counter.counterURL = url; }, //若统计文章或相册需要指定相应的id setId:function(id){ Counter.id = id; }, //增加搜索引擎网址 appendEngine:function(URL){ Counter.engineURL = Counter.engineURL + "," + URL; }, init:function(){ Counter.source = (null!=document.referrer&&document.referrer!="undefined")?document.referrer:""; Counter.clientScreen = window.screen.width+"*"+window.screen.height; Counter.clientColor = window.screen.colorDepth + "bit"; /*Counter.clientAgent = navigator.appName;  Counter.clientOS = navigator.platform; */ Counter.clientAgent = "";//浏览器  Counter.clientOS = "";//操作系统 Counter.clientLanguage = navigator.systemLanguage?navigator.systemLanguage:navigator.language; //计算客户端操作系统以及浏览器信息 var userAgent = navigator.userAgent; if(userAgent.indexOf("NT 5.0")>0){ Counter.clientOS = "WindowsServer2000"; }else if(userAgent.indexOf("NT 5.1")>0){ Counter.clientOS = "WindowsXP"; }else if(userAgent.indexOf("NT 5.2")>0){ Counter.clientOS = "WindowsServer2003"; }else if(userAgent.indexOf("NT 6.0")>0){ Counter.clientOS = "WindowsVista"; } if(navigator.appName.indexOf("Microsoft")>-1){ Counter.clientAgent = userAgent.split(";")[1]; }else{ Counter.clientAgent = userAgent.split(";")[4].split(" ")[3]; } //Counter.engineSource = ""; //Counter.engineKey = ""; //Counter.ajax = new AJAXRequest; Counter.url = Counter.counterURL + "?type=" + Counter.countType + "&cluster_node_id=" + Counter.nodeID + "&source=" + Counter.source + "&clientScreen=" + Counter.clientScreen + "&clientColor=" + Counter.clientColor + "&clientAgent=" + Counter.clientAgent + "&clientOS=" + Counter.clientOS + "&clientLanguage=" + Counter.clientLanguage.toLowerCase() + "&id=" + Counter.id; }, count:function(){ //统计 //alert(Counter.url); var iframe = document.createElement("iframe"); iframe.setAttribute("frameborder","0"); iframe.setAttribute("hspace","0"); iframe.setAttribute("marginheight","0"); iframe.setAttribute("marginwidth","0"); iframe.setAttribute("scrolling","no"); iframe.setAttribute("vspace","0"); iframe.setAttribute("src",Counter.url); iframe.style.display = "none"; document.body.appendChild(iframe); } } Counter.setCounterURL("../../counter"); //统计程序对应的路径 Counter.setNodeID("root"); Counter.setType("article"); Counter.setId("130433"); Counter.init(); Counter.count(); //若使用iframe进行统计请不要调用此方法