<div class="codetitle"> <span><a style="CURSOR: pointer" data="99811" class="copybut" id="copybut99811" onclick="doCopy('code99811')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code99811"> <br> <br> <br> <br><title></title> <br> <br> <br><script type="text/javascript"> <BR>function browserinfo() { <BR>var Browser_Name = navigator.appName; <BR>var Browser_Version = parseFloat(navigator.appVersion); <BR>var Browser_Agent = navigator.userAgent; <BR>var Actual_Version, Actual_Name; <BR>var is_IE = (Browser_Name == "Microsoft Internet Explorer"); //判读是否为ie浏览器 <BR>var is_NN = (Browser_Name == "Netscape"); //判断是否为netscape浏览器 <BR>var is_op = (Browser_Name == "Opera"); //判断是否为Opera浏览器 <BR>if (is_NN) { <BR>//upper 5.0 need to be process,lower 5.0 return directly <BR>if (Browser_Version >= 5.0) { <BR>if (Browser_Agent.indexOf("Netscape") != -1) { <BR>var Split_Sign = Browser_Agent.lastIndexOf("/"); <BR>var Version = Browser_Agent.lastIndexOf(" "); <BR>var Bname = Browser_Agent.substring(0, Split_Sign); <BR>var Split_sign2 = Bname.lastIndexOf(" "); <BR>Actual_Version = Browser_Agent.substring(Split_Sign + 1, Browser_Agent.length); <BR>Actual_Name = Bname.substring(Split_sign2 + 1, Bname.length); <BR>} <BR>if (Browser_Agent.indexOf("Firefox") != -1) { <BR>var Split_Sign = Browser_Agent.lastIndexOf("/"); <BR>var Version = Browser_Agent.lastIndexOf(" "); <BR>Actual_Version = Browser_Agent.substring(Split_Sign + 1, Browser_Agent.length); <BR>Actual_Name = Browser_Agent.substring(Version + 1, Split_Sign); <BR>} <BR>if (Browser_Agent.indexOf("Safari") != -1) { <BR>if (Browser_Agent.indexOf("Chrome") != -1) { <BR>var Split_Sign = Browser_Agent.lastIndexOf(" "); <BR>var Version = Browser_Agent.substring(0, Split_Sign); ; <BR>var Split_Sign2 = Version.lastIndexOf("/"); <BR>var Bname = Version.lastIndexOf(" "); <BR>Actual_Version = Version.substring(Split_Sign2 + 1, Version.length); <BR>Actual_Name = Version.substring(Bname + 1, Split_Sign2); <BR>} <BR>else { <BR>var Split_Sign = Browser_Agent.lastIndexOf("/"); <BR>var Version = Browser_Agent.substring(0, Split_Sign); ; <BR>var Split_Sign2 = Version.lastIndexOf("/"); <BR>var Bname = Browser_Agent.lastIndexOf(" "); <BR>Actual_Version = Browser_Agent.substring(Split_Sign2 + 1, Bname); <BR>Actual_Name = Browser_Agent.substring(Bname + 1, Split_Sign); <BR>} <BR>} <BR>} <BR>else { <BR>Actual_Version = Browser_Version; <BR>Actual_Name = Browser_Name; <BR>} <BR>} <BR>else if (is_IE) { <BR>var Version_Start = Browser_Agent.indexOf("MSIE"); <BR>var Version_End = Browser_Agent.indexOf(";", Version_Start); <BR>Actual_Version = Browser_Agent.substring(Version_Start + 5, Version_End) <BR>Actual_Name = Browser_Name; <BR>if (Browser_Agent.indexOf("Maxthon") != -1 || Browser_Agent.indexOf("MAXTHON") != -1) { <BR>var mv = Browser_Agent.lastIndexOf(" "); <BR>var mv1 = Browser_Agent.substring(mv, Browser_Agent.length - 1); <BR>mv1 = "遨游版本:" + mv1; <BR>Actual_Name += "(Maxthon)"; <BR>Actual_Version += mv1; <BR>} <BR>} <BR>else if (Browser_Agent.indexOf("Opera") != -1) { <BR>Actual_Name = "Opera"; <BR>var tempstart = Browser_Agent.indexOf("Opera"); <BR>var tempend = Browser_Agent.length; <BR>Actual_Version = Browser_Version; <BR>} <BR>else { <BR>Actual_Name = "Unknown Navigator" <BR>Actual_Version = "Unknown Version" <BR>} <BR>/*------------------------------------------------------------------------------ <BR>--Your Can Create new properties of navigator(Acutal_Name and Actual_Version) -- <BR>--Userage: -- <BR>--1,Call This Function. -- <BR>--2,use the property Like This:navigator.Actual_Name/navigator.Actual_Version;-- <BR>------------------------------------------------------------------------------*/ <BR>navigator.Actual_Name = Actual_Name; <BR>navigator.Actual_Version = Actual_Version; <BR>/*--------------------------------------------------------------------------- <BR>--Or Made this a Class. -- <BR>--Userage: -- <BR>--1,Create a instance of this object like this:var browser=new browserinfo;-- <BR>--2,user this instance:browser.Version/browser.Name; -- <BR>---------------------------------------------------------------------------*/ <BR>this.Name = Actual_Name; <BR>this.Version = Actual_Version; <BR>} <BR>browserinfo(); <BR>// document.write("你使用的浏览器是:"+navigator.userAgent); <BR>//document.write("<br>"); <BR>// document.write("你使用的浏览器是:"+navigator.Actual_Name+",版本号:"+navigator.Actual_Version); <BR>function closewin() { <BR>var type = ""; <BR>var ua = navigator.userAgent; <BR>if (ua.indexOf("MSIE") >= 0) { <BR>type = "MSIE"; <BR>if (navigator.Actual_Version == "7.0") { <BR>type += "7"; <BR>} <BR>else if (navigator.Actual_Version == "6.0") { <BR>type += "6"; <BR>} <BR>} <BR>else if (ua.indexOf("Firefox") >= 0) { <BR>type = "FF"; <BR>} <BR>if (type == "MSIE6") { <BR>window.opener = null; <BR>window.close(); <BR>} <BR>else if (type == "MSIE7") { <BR>window.open('', '_top'); <BR>window.top.close(); <BR>} <BR>else if (type == "FF") { <BR>window.open('', '_parent', ''); <BR>window.close(); <BR>} <BR>} <BR>window.onload = function() { <BR>closewin(); <BR>} <BR></script> <br><input type="button" value="没有提示关闭" onclick="closewin()"> <br> <br> <br> </div>