web 页面如何动态适应不同的页面分辨率
2013-05-13 15:49
295 查看
<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;
}
//-->
<!--
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;
}
//-->
相关文章推荐
- 小程序web-view动态显示h5页面,根据不同条件显示不同网页——微信web-view高级用法13
- 如何在一个页面中动态放置多个Droppable来接受不同的Draggable?(accept参数的用法)
- Android布局layout如何适应不同的分辨率和不同大小的屏幕
- 在WEB页面中根据分辨率自动调整内容宽度,以适应表格宽度
- 如何在一个页面中动态放置多个Droppable来接受不同的Draggable?(accept参数的用法)
- Webview--如何让加载进来的页面自适应手机屏幕分辨率
- 如何动态调试WEB页面
- Webview--如何让加载进来的页面自适应手机屏幕分辨率居中显示
- Webview--如何让加载进来的页面自适应手机屏幕分辨率居中显示
- 如何在一个页面中动态放置多个Droppable来接受不同的Draggable?(accept参数的用法)
- 如何在一个页面中动态放置多个Droppable来接受不同的Draggable?(accept参数的用法)
- Webview--如何让加载进来的页面自适应手机屏幕分辨率居中显示
- 如何使页面中元素的尺寸动态变化适应页面
- Webview--如何让加载进来的页面自适应手机屏幕分辨率居中
- 如何在一个页面中动态放置多个Droppable来接受不同的Draggable?(accept参数的用法)
- Webview--如何让加载进来的页面自适应手机屏幕分辨率
- Webview--如何让加载进来的页面自适应手机屏幕分辨率居中显示
- 七牛用户如何将视频转码成普清高清来适应不同的手机端或者web端
- 两个并排的DIV 左面一个的width=175 右面的那个DIV如何自适应不同分辨率填充满屏幕
- 如何让Android自适应不同分辨率或不同屏幕大小的layout布局