/**
* vlstat 浏覽器統計腳本
*/
var statIdName = "vlstatId";
var xmlHttp;
/**
* 設置cookieId
*/
function setCookie(c_name
var exdate = new Date();
exdate
document
}
/**
* 獲取cookieId
*/
function getCookie(c_name) {
if (document
c_start = document
if (c_start !=
c_start = c_start + c_name
c_end = document
if (c_end ==
c_end = document
}
return unescape(document
}
}
return "";
}
/**
* 獲取當前時間戳
*/
function getTimestamp() {
var timestamp = Date
return timestamp;
}
/**
* 生成statId
*/
function genStatId() {
var cookieId = getTimestamp();
cookieId = "vlstat" + "
return cookieId;
}
/**
* 設置StatId
*/
function setStatId() {
var cookieId = genStatId();
setCookie(statIdName
}
/**
* 獲取StatId
*/
function getStatId() {
var statId = getCookie(statIdName);
if (statId != null && statId
return statId;
} else {
setStatId();
return getStatId();
}
}
/**
* 獲取UA
*/
function getUA() {
var ua = navigator
if (ua
ua = ua
}
return ua;
}
/**
* 獲取浏覽器類型
*/
function getBrower() {
var ua = getUA();
if (ua
return "Maxthon";
} else if (ua
return "MSIE";
} else if (ua
return "Firefox";
} else if (ua
return "Chrome";
} else if (ua
return "Opera";
} else if (ua
return "Safari";
} else {
return "ot";
}
}
/**
* 獲取浏覽器語言
*/
function getBrowerLanguage() {
var lang = navigator
return lang != null && lang
}
/**
* 獲取操作系統
*/
function getPlatform() {
return navigator
}
/**
* 獲取頁面title
*/
function getPageTitle() {
return document
}
/**
* 創建一個form
*
* @return
*/
function createSubmitForm() {
var frm = document
document
frm
return frm;
}
/**
* 為form創建一個元素
*
* @param inputForm
* @param elementName
* @param elementValue
* @return
*/
function createFormElement(frmInput
var element = document
element
element
element
element
frmInput
return element;
}
/**
* 構造XMLHttpRequest對象
*
* @return
*/
function createXMLHttpRequest() {
if (window
xmlHttp = new ActiveXObject(
} else if (window
xmlHttp = new XMLHttpRequest();
}
}
/**
* url指定跳轉頁
*
* @param url
* @param data
* @param func
* @return
*/
function AjaxPost(url
var httpRequest = createHttpRequest();
if (httpRequest) {
("POST"
("content
("Content
(data);
() {
if {
try {
if {
if (func) {
// 這裡可以調用想要的函數
func(
}
}
} catch (e) {
alert("Error XMLHttpRequest!");
}
}
}
} else {
alert("Error initializing XMLHttpRequest!");
}
}
function vlstatInitLE(vlch
var p;
var vlstatCH = vlch != null && vlch
var vlstatCH
var vlstatCH
var vlstatCH
var vlstatCookieId = getStatId();
var vlstatUA = encodeURIComponent(getUA());
var vlstatIPAddress = document
var vlstatREFURL = encodeURIComponent(document
var vlstatURL = encodeURIComponent(document
var vlstatScreenX = screen
var vlstatScreenY = screen
var vlstatOS = getPlatform();
var vlstatBrower = getBrower();
var vlstatBrowerLanguage = getBrowerLanguage();
var vlstatPageTitle = encodeURIComponent(getPageTitle());
var vlstatAction = "index
p = "cookieId=" + vlstatCookieId + "&ua=" + vlstatUA + "&ip=" + vlstatIPAddress + "&refurl="
+ vlstatREFURL + "&url=" + vlstatURL + "&screenX=" + vlstatScreenX + "&screenY=" + vlstatScreenY
+ "&os=" + vlstatOS + "&brower=" + vlstatBrower + "&browerLang=" + vlstatBrowerLanguage
+ "&title=" + vlstatPageTitle + "&ch=" + vlstatCH + "&ch
+ "&ch
var urlGo = vlstatAction + "?" + p;
createXMLHttpRequest();
xmlHttp
xmlHttp
}
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20528.html