当前位置: 首页 > 图文教程 > 网络编程 > Javascript > 用js自动判断浏览器分辨率的代码

Javascript
一种表格背景色渐变效果的实现
一组单选按钮radio如何进行控制
Bmail联系人飞来飞去效果
mouseover时显示滚动字幕 特效
window.open()弹出居中的窗口
做网页的一些技巧
背景音乐每次刷新都可以自动更换
Javascript 判断 object 的特定类转载
Javascript的荧光字效果
任意位置显示html菜单
HTTP状态代码以及定义(解释)
JavaScript中“+=”的应用
函数式JavaScript编程指南
如何优化JavaScript脚本的性能
Code:loadScript( )加载js的功能函数
关于实现代码语法标亮 dp.SyntaxHighlighter
JavaScript 学习 - 提高篇
Javascript的IE和Firefox兼容性汇编(zz)
如何判断图片地址是否失效
javascript汉字转拼音的代码

Javascript 中的 用js自动判断浏览器分辨率的代码


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 52 ::
收藏到网摘: n/a

复制代码 代码如下:

<SCRIPT LANGUAGE="JavaScript">
<!--
if (window.navigator.userAgent.indexOf("MSIE")>=1)
{
var IE1024="";
var IE800="";
var IE1152="";
var IEother="";
ScreenWidth(IE1024,IE800,IE1152,IEother)
}
else{
if (window.navigator.userAgent.indexOf("Firefox")>=1)
{
var Firefox1024="";
var Firefox800="";
var Firefox1152="";
var Firefoxother="";
ScreenWidth(Firefox1024,Firefox800,Firefox1152,Firefoxother)
}
else{
var Other1024="";
var Other800="";
var Other1152="";
var Otherother="";
ScreenWidth(Other1024,Other800,Other1152,Otherother)
}
}
function ScreenWidth(CSS1,CSS2,CSS3,CSS4){
if ((screen.width == 1024) && (screen.height == 768)){
setActiveStyleSheet(CSS1);
}else{
if ((screen.width == 800) && (screen.height == 600)){
setActiveStyleSheet(CSS2);
}else{
if ((screen.width == 1152) && (screen.height == 864)){
setActiveStyleSheet(CSS3);
}else{
setActiveStyleSheet(CSS4);
}}}
}
function setActiveStyleSheet(title){
document.getElementsByTagName("link")[0].href="style/"+title;
}
//-->
</SCRIPT>