zoukankan      html  css  js  c++  java
  • SLib SDocument 文档操作

          SDocument = new Object();
         SDocument.getDocument = function(){
                                      if(document.compatMode=="CSS1Compat"){
                                           return document.documentElement;
                                      }
                                      else{
                                           return document.body;
                                      }
                                 }
         SDocument.getRectangle = function (){
                                        if(window.innerWidth){
                                           return [window.innerWidth,window.innerHeight];
                                        }
                                        else{
                                              if(document.compatMode=="CSS1Compat"){
                                                   return [document.documentElement.clientWidth,document.documentElement.clientHeight];
                                              }
                                              else{
                                                   return [document.body.clientWidth,document.body.clientHeight];
                                              }
                                        }
                                   }
         SDocument.getViewportRectangle =function(){
                                                  if(document.compatMode=="CSS1Compat"){
                                                       return [document.documentElement.scrollWidth,document.documentElement.scrollHeight];
                                                  }
                                                  else{
                                                       return [document.body.scrollWidth,document.body.scrollHeight];
                                                  } 
                                         }
         SDocument.getWidth = function (){
                                        var w = SDocument.getViewportRectangle();
                                        return Math.max(w[0],SDocument.getWidth());  
                              }
         SDocument.getHeight =function(){
                                            var h =SDocument.getViewportRectangle();
                                            return h[1];
                              }
         SDocument.getScrollLeft =function(){  
                                       return parseInt(SDocument.getDocument().scrollLeft);
                                  }
         SDocument.getScrollTop = function(){
                                       return parseInt(SDocument.getDocument().scrollTop);
                                       }
         SDocument.getViewportWidth =function(){
                                              var w=SDocument.getRectangle();
                                              return parseInt(w[0]);
                                     }
         SDocument.getViewportHeight =function(){
                                              var h=SDocument.getRectangle();
                                              return parseInt(h[1]);
                                     }
                                     
                                    

  • 相关阅读:
    用Python写春联:抒写最真诚的祝福和最美好的祈愿
    python 注册表操作
    python 多参数
    arcgis tin版本转换使用复制tin
    python基础知识
    模型免费学习地址https://space.bilibili.com/378493128?spm_id_from=333.788
    在Python中用turtle函数画同心圆
    solr系统query检索词特殊字符的处理
    C#winform抓取百度,Google搜索关键词结果
    理解Solr缓存及如何设置缓存大小
  • 原文地址:https://www.cnblogs.com/swneng/p/Slib.html
Copyright © 2011-2022 走看看