zoukankan      html  css  js  c++  java
  • SLibSElement元素操作

            function SElement(eleId){
               var self = SLib.getElement(eleId);
               this.getElement = function (){
                                     return self;
                                 }
               this.getXY = function () {
                                return SLib.getXY(self);
                            }
               this.getX =  function () {
                               return  SLib.getXY(self)[0];
                            }
               this.getY = function () {
                                return  SLib.getXY(self)[1];
                            }
               this.setXY =  function (x,y){
                             self.style.left = x+"px";
                             self.style.top = y +"px";
                             }
               this.setX = function (x) {
                           self.style.left = x+"px";
                           }
               this.setY = function (y) {
                           self.style.top =  y +"px";
                           }
               this.getStyle = function(s){
                                   return self.style[s];
                               }
               this.setStyle = function(s,value){
                                    self.style[s] =value;
                               }
               this.getWidth = function(){
                                    return self.offsetWidth;
                               }
               this.getHeight = function(){
                                    return self.offsetHeight;
                                }
               this.getAttribute =function (s){
                                    return self.getAttribute(s);
                                  }
               this.getRectangle = function(){
                                       return [this.getWidth(),this.getHeight()];   
                                   }
               this.alignTo = function(ele,direction){
                                   var l = ele.getX();
                                   var t = ele.getY();
                                   var w = ele.getWidth();
                                   var h = ele.getHeight();
                                   switch(direction){
                                      case "lt" :this.setX(l);
                                                 this.setY(t);
                                                 break;
                                      case "lb" :this.setX(l);
                                                 this.setY(t+h);
                                                 break;
                                      case "rt" :this.setX(l+w);
                                                 this.setY(t);
                                                 break;
                                      case "rb" :this.setX(l+w);
                                                 this.setY(t+h);
                                                 break;
                                         default:break;
                                   }
                          
         
                           }
             
        }
  • 相关阅读:
    DButils工具类能够用来获取数据库连接向数据库插入更新删除对象
    Android 实现ActionBar定制
    查看CentOs6.5/7的系统版本号
    安装Was liberty之步骤
    在centOS上安装VNC
    SCP远程拷贝命令
    Was liberty资料总结
    罗杰斯:做你喜欢的工作,你会变成个有钱人
    【Java/csv】一个CSV文件解析类(转载)
    当你的才华还撑不起你的野心时,那你就应该静下心来学习。
  • 原文地址:https://www.cnblogs.com/swneng/p/1304886.html
Copyright © 2011-2022 走看看