代码改变世界

js的一些代码

2012-11-19 09:30  yangpan  阅读(154)  评论(0编辑  收藏  举报

}
function getStringLen(b) {
var a = b.match(/[^\x00-\xff]/ig);
return b.length + (a == null ? 0 : a.length)
}
function getBrowserType() {
var a = 0;
if (window.ActiveXObject) {
if (window.XMLHttpRequest && !window.XDomainRequest) {
return 5
} else {
if (window.XDomainRequest) {
return 6
} else {
return 1
}
}
} else {
if (typeof (Components) == "object") {
a = 2
} else {
if (typeof (window.opera) == "object") {
a = 3
} else {
if (window.MessageEvent && !document.getBoxObjectFor) {
a = 7
} else {
if (navigator.appVersion.indexOf("Safari") >= 0) {
a = 4
}
}
}
}
}
return a
}
function checkCookieEnabled() {
try {
if (navigator.cookieEnabled == false) {
return false
}
} catch (a) {}
return true
}