js判断用户浏览器类型代码

时间:2013-02-20 06:10:02  来源:第二电脑网  作者:第二电脑网

  第二电脑网导读:opera = userAgent.indexOf('opera') != -1 && opera.version(); var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3); var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3); function $$(obj) { retu...
  正文:js(第二电脑网http://www.002pc.com)判断用户浏览器类型代码

js(第二电脑网http://www.002pc.com)判断用户浏览器类型代码
<script type="text/JavaScript">
var userAgent = navigator.userAgent.toLowerCase();
var is_opera = userAgent.indexOf('opera') != -1 && opera.version();
var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3);
var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);
function $$(obj) { return document.getElementById(obj); }
function getCookieVal(offset) { var endstr = document.cookie.indexOf(";", offset);if (endstr == -1) { endstr = document.cookie.length;} return unescape(document.cookie.substring(offset, endstr)); }
function getCookie(name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length;var i = 0;while (i < clen) {var j = i + alen; if (document.cookie.substring(i, j) == arg) { return getCookieVal(j); } i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; }return ""; }
function setCookie(name, value, expires, path, domain, secure) {document.cookie = name + "=" + escape(value) +((expires) ? "; expires=" + expires : "") +((path) ? "; path=" + path : "") +((domain) ? "; domain=" + domain : "") +((secure) ? "; secure" : "");}
</script>

js判断用户浏览器类型代码》由第二电脑网原创提供,转载请注明:http://www.002pc.com/master/College/Programming/JavaScript/27208.html


关于《js判断用户浏览器类型代码》文章的评论

站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td