需求
   1.根据不同的液晶宽度或者高度能自动调整出同样的布局。   2.如果,使用JS完成的话如果换操作系统是否影响呢?   3.是否可以把数据展示的布局能根据当前显示器大小调整相应的布局呢。   谢谢,大侠们。

解决方案 »

  1.   

    use
    document.body.clientHeight
    document.body.clientWidth
    to get the actual size in different resolutions
      

  2.   

       目前,我是没有找到这样的方法啊。如果,针对于WIN那么换OS不就是挂了嘛
      

  3.   

    <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>这也是根据不同浏览器以及显示器大小得到分辨率