使用navigator 1.使用navigator对象 <script> document.write("navigator对象的属性"+"<br>") document.write("appcodename:"+navigator.appCodeName+"<br>") document.write("appname::"+navigator.appName+"<br>") document.write("appversion:"+navigator.appVersion+"<br>") document.write("platform:"+navigator.platform+"<br>") document.write("userAgent:"+navigator.userAgent+"<br>") </script> <script> document.write("navigator对象的方法"+"<br>") document.write("javaEnabled():"+navigator.javaEnabled()) </script> 2.检查用户的浏览器 <script> if(navigator.appName.indexOf("Microsoft")!=-1)...{ document.write("用户浏览器是微软的IE浏览器"+"<br>")} else if(navigator.appName.indexOf("Netscape")!=-1)...{ document.write("用户浏览器是netscape的netscape浏览器"+"<br>")} if(navigator.appVersion.indexOf("4.0")!=-1)...{ document.write("you are using a version 4.0compatible browser") } else...{ document.write("this browser is not 4.0 compliant")} </script> 3.检测用户的操作系统 <script> if (navigator.platform.indexOf("win32")!=-1)...{ document.write("you are using a computer running windows 95 or highter")} else...{ document.write("this computer is not running windows 95 or higher")} </script> 4.使用location对象 <script> document.write("location对象的属性"+"<br>") document.write("hash"+location.hash+"<br>") document.write("hostname"+location.hostname+"<br>") document.write("host"+location.host+"<br>") document.write("href"+location.href+"<br>") document.write("port"+location.port+"<br>") document.write("search"+location.search+"<br>") </script> 重新加载网页 <form name=form1> <input type=button name=button1 value=重新加载本页 onclick=location.reload> </form> 5.使用cookie <script> finction makecookie()...{ if(!document.cookie)...{ name=prompt("请输入你的姓名"); document.cookie="name="+name+";";} } </script> <body onload=makecookie()> <script> function makecookie()...{ if(!document.cookie)...{ name=prompt("请输入你的姓名") document.cookie="name="+name+";"; namestart=document.cookie.indexOf("="); nameend=document.cookieindexOf(";"); document.writeln("your name is:" +document.cookie.substring(namestart+1,nameend)+",br>") } } </script>