var Sys = {};
var ua = navigator.userAgent.toLowerCase();
if (window.ActiveXObject)//IE
Sys.ie = ua.match(/msie ([/d.]+)/)[1]
else if (document.getBoxObjectFor)//Firefox
Sys.firefox = ua.match(/firefox//([/d.]+)/)[1]
else if (window.MessageEvent && !document.getBoxObjectFor)//Chrome
Sys.chrome = ua.match(/chrome//([/d.]+)/)[1]
else if (window.opera)//Opera
Sys.opera = ua.match(/opera.([/d.]+)/)[1]
else if (window.openDatabase)//Safari
Sys.safari = ua.match(/version//([/d.]+)/)[1];
var ua = navigator.userAgent.toLowerCase();
if (window.ActiveXObject)//IE
Sys.ie = ua.match(/msie ([/d.]+)/)[1]
else if (document.getBoxObjectFor)//Firefox
Sys.firefox = ua.match(/firefox//([/d.]+)/)[1]
else if (window.MessageEvent && !document.getBoxObjectFor)//Chrome
Sys.chrome = ua.match(/chrome//([/d.]+)/)[1]
else if (window.opera)//Opera
Sys.opera = ua.match(/opera.([/d.]+)/)[1]
else if (window.openDatabase)//Safari
Sys.safari = ua.match(/version//([/d.]+)/)[1];
//以下进行测试
if (Sys.ie) alert('IE: ' + Sys.ie);//Sys.ie是版本号
if (Sys.firefox) alert('Firefox: ' + Sys.firefox);
if (Sys.chrome) alert('Chrome: ' + Sys.chrome);
if (Sys.opera) alert('Opera: ' + Sys.opera);
if (Sys.safari) alert('Safari: ' + Sys.safari);
if (Sys.ie) alert('IE: ' + Sys.ie);//Sys.ie是版本号
if (Sys.firefox) alert('Firefox: ' + Sys.firefox);
if (Sys.chrome) alert('Chrome: ' + Sys.chrome);
if (Sys.opera) alert('Opera: ' + Sys.opera);
if (Sys.safari) alert('Safari: ' + Sys.safari);