<div class="htmlarea"> <textarea id="runcode12231"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <title>javascript检测浏览器类型和版本号(兼容各浏览器) </title> <script language="javascript" type="text/javascript"> var uA = navigator.userAgent; var browserType = "unknown"; if (uA.indexOf("Opera") > -1) { browserType = "Opera"; } else if (uA.indexOf("Safari") > -1) { browserType = "Safari"; } else if (uA.indexOf("Konqueror") > -1) { browserType = "Konqueror"; } else if (uA.indexOf("Gecko") > -1) { browserType = "Mozilla"; } else if (uA.indexOf("MSIE") > -1) { browserType = "Internet Explorer"; } //window.alert(browserType); document.write(browserType); document.write(" "); document.write(document.lastModified); //显示页面的修改日期 document.write(" "); document.write(navigator.userAgent); //显示客户端环境参数 document.write(" "); document.write("h,w:"+screen.availHeight+"x"+screen.availWidth+"pixels");//测定显示器大小 //显示器大小 function screenWH(){ var getscreen=document.getElementById('screenWH'); getscreen.value=screen.availHeight+"x"+screen.availWidth; var divscreen=document.getElementById('screensWH'); divscreen.value=screen.availHeight+"x"+screen.availWidth+"pixels"; //window.screen.height+"+"+window.screen.width; } </script> <input type="text" id="screenWH"> <input type="button" onclick="notEmpty()" value="Form Checker"> <div id="screensWH"></div> </textarea><br><input onclick="runEx('runcode12231')" type="button" value="运行代码"> <input onclick="doCopy('runcode12231')" type="button" value="复制代码"> <input onclick="doSave(runcode12231)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]</div> <br>相关文章:<br><a href="http://www.jb51.net/article/20024.htm" target="_blank">javascript 检测浏览器类型和版本的代码</a><br><a href="http://www.jb51.net/article/17302.htm" target="_blank">javascript 浏览器检测代码精简版<br>JavaScript 判断浏览器类型及版本</a>