彩信DIy JS代码

彩信DIy 

function EntirelyAttribute()
{
    this.GetPixelLeft = function(ObjectName)
    {
        return ObjectName.style.pixelLeft;
    }
    this.GetPixelTop = function(ObjectName)
    {
        return ObjectName.style.pixelTop;
    }
    this.GetMarginLeft = function(ObjectName)
    {
        return ObjectName.style.marginLeft;
    }
    this.GetMarginTop = function(ObjectName)
    {
        return ObjectName.style.marginTop;
    }
    this.SetObjectPixelLeft = function(ObjectName,intValue)
    {
         return ObjectName.style.pixelLeft = intValue;
    }
    this.SetObjectPixelTop = function(ObjectName,intValue)
    {
        return ObjectName.style.pixelTop = intValue;
    }
    this.SetObjectMarginLeft = function(ObjectName,intValue)
    {
        return  ObjectName.style.MarginLeft= intValue;
    }
    this.SetObjectMarginTop = function(ObjectName,intValue)
    {
        return  ObjectName.style.MarginTop= intValue;
    }
   
}

function ColorInfoSelectDiv(DivObject)
{
 
    this.SetPixelLeft = function(intValue)
    {
        DivObject.style.pixelLeft = intValue;
    }
    this.GetPixelLeft = function()
    {
        return DivObject.style.pixelLeft;
    }
    this.GetPixelTop = function()
    {
        return  DivObject.style.pixelTop;
    }
    this.SetPixelTop = function(intValue)
    {
        DivObject.style.pixelTop = intValue
    }
    this.GetObjectDiv = function()
    {
        return DivObject;
    }
    this.GetWidth = function()
    {
        return DivObject.style.width.replace("px","");
    }
    this.SetWidth = function(intValue)
    {
        DivObject.style.width = intValue;
    }
    this.GetHeight = function()
    {
        return DivObject.style.height.replace("px","");
    }
    this.SetHeight = function(intValue)
    {
        DivObject.style.height = intValue;
    }
    this.GetpixelWidth = function()
    {
        return DivObject.style.pixelWidth;
    }
    this.GetpixelHeight = function()
    {
       return DivObject.style.pixelHeight;
    }
    this.GetpixelRight = function()
    {
        return DivObject.style.pixelRight;
    }
}

function ColorInfoImageBg(ImageBg)
{
    this.SetPixelLeft = function(intValue)
    {
        ImageBg.style.pixelLeft = intValue;
    }
    this.GetPixelLeft = function()
    {
        return ImageBg.style.pixelLeft;
    }
    this.GetPixelTop = function()
    {
        return  ImageBg.style.pixelTop;
    }
    this.SetPixelTop = function(intValue)
    {
        ImageBg.style.pixelTop = intValue
    }
    this.GetImageBg = function()
    {
        return ImageBg;
    }
    this.GetWidth = function()
    {
        return ImageBg.style.width.replace("px","");
    }
    this.SetWidth = function(intValue)
    {
        ImageBg.style.width = intValue;
    }
    this.GetHeight = function()
    {
        return ImageBg.style.height.replace("px","");
    }
    this.SetHeight = function(intValue)
    {
        ImageBg.style.height = intValue;
    }
    this.GetWidth = function()
    {
       return ImageBg.style.pixelWidth;
    }
    this.GetHeight = function()
    {                      
       return ImageBg.style.pixelHeight;
    }
}

function ColorInfoSelectImage(ImageObject)
{
    this.SetMarginLeft = function(intValue)
    {
        ImageObject.style.marginLeft = intValue;
    }
    this.GetMarginLeft = function()
    {
        return ImageObject.style.MarginLeft;
    }
    this.GetMarginTop = function()
    {
        return  ImageObject.style.MarginTop;
    }
    this.SetMarginTop = function(intValue)
    {
        ImageObject.style.marginTop = intValue
    }
    this.GetImageObject = function()
    {
        return ImageObject;
    }
    this.GetWidth = function()
    {
        return ImageObject.style.width.replace("px","");
    }
    this.SetWidth = function(intValue)
    {
        ImageObject.style.width = intValue;
    }
    this.GetHeight = function()
    {
        return ImageObject.style.height.replace("px","");
    }
    this.SetHeight = function(intValue)
    {
        ImageObject.style.height = intValue;
    }
}

function $(_id)
{
    return document.getElementById(_id);
}

function ColorInfoDiYMouse()
{
    var TemptX = event.clientX;
    var TemptY = event.clientY;
    this.GetX = function ()
    {
        return TemptX;
    }
    this.SetX = function(intValueX)
    {
        TemptX = intValueX;
    }
    this.GetY = function ()
    {
        return TemptY;
    }
    this.SetY = function(intValueY)
    {
        TemptY = intValueY;
    }
}

function picDrag(ImageDrag)
{
    this.SetPixelLeft = function(intValue)
    {
        ImageDrag.style.pixelLeft = intValue;
    }
    this.GetPixelLeft = function()
    {
        return ImageDrag.style.pixelLeft;
    }
    this.GetPixelTop = function()
    {
        return  ImageDrag.style.pixelTop;
    }
    this.SetPixelTop = function(intValue)
    {
        ImageDrag.style.pixelTop = intValue;
    }
   
    this.GetObjectDiv = function()
    {
        return ImageDrag;
    }
}

function PicLoad()
{
        objectVar = new GetPublicVariable();
       ImageBgObject = new ColorInfoImageBg(objectVar.GetPicBgID());
       ImageSelect = new ColorInfoSelectImage(objectVar.GetSelectPicID());
       CSDiv = new ColorInfoSelectDiv(objectVar.GetSelectDivID());
       ImageDrag = new picDrag(objectVar.GetImageDrag());
    
     ImageBgLeft = ImageBgObject.GetPixelLeft();
     ImageBgTop = ImageBgObject.GetPixelTop();
     ImageBgH = ImageBgObject.GetHeight();
    
     CSDiv.SetPixelLeft(ImageBgLeft);
     CSDiv.SetPixelTop(ImageBgTop-ImageBgH-5);
    
     ImageSelect.SetMarginLeft(CSDiv.GetPixelLeft());
     ImageSelect.SetMarginTop(Math.abs(CSDiv.GetPixelTop()) - ImageBgH-4);
     
      ImageDragLeft = CSDiv.GetPixelLeft() + parseInt(CSDiv.GetWidth())+2;
      imageDragTop = CSDiv.GetPixelTop() - CSDiv.GetHeight()+125;
    
    ImageDrag.SetPixelLeft(ImageDragLeft);
    ImageDrag.SetPixelTop(imageDragTop);
//   
//     window.status="X="+CSDiv.GetPixelLeft()+" Y="+ImageBgTop;
}

function MouseMoves()
{
    this.DragImage = function()
    {
          if(event.button == 1 && objectVar.GetState() == true )
          {
            MX = event.clientX - Mouse.GetX();
            MY = event.clientY - Mouse.GetY();
           
            if((DivLeft+MX) < (ImageBg.GetWidth()-CSDiv.GetpixelWidth()) && (DivLeft+MX) >= 0)
            {
                CSDiv.SetPixelLeft(DivLeft + MX);
                ImageSelect.SetMarginLeft(-CSDiv.GetPixelLeft()-1);
                DrLeft = DLeft+MX;
                imgDrag.SetPixelLeft(DrLeft);
               
            }
            ImageBgH = ImageBg.GetHeight();
            if(((Math.abs(DivTop+MY)-5)-CSDiv.GetpixelHeight()) >= 0 && ((Math.abs(DivTop+MY)-5)-CSDiv.GetpixelHeight()) <= (ImageBgH-CSDiv.GetpixelHeight()))
            {
               ImageBgH = ImageBg.GetHeight();
               CSDiv.SetPixelTop(DivTop + MY);
               ImageSelect.SetMarginTop(Math.abs(CSDiv.GetPixelTop()) - ImageBgH-5);
               DrTop = (DTop+MY);
               imgDrag.SetPixelTop(DrTop);
            }
            dd=CSDiv.GetWidth();
            gg=CSDiv.GetHeight();
             //window.status="h="+CSDiv.GetPixelTop()+",d="+(ImageBgH+4)+",f="+((Math.abs(DivTop+MY)-4)-CSDiv.GetpixelHeight())+" Y="+(ImageBg.GetHeight()-CSDiv.GetpixelHeight())+"H="+CSDiv.GetpixelHeight()+"w="+dd+" h="+gg;
//             window.status=" bgh="+ImageBgH+" divTop="+CSDiv.GetPixelTop();
            return false;
          }
  
    }
   
    this.Resize = function()
    {
        if(event.button == 1 && objectVar.GetState() == true )
        {
             MX = event.clientX - Mouse.GetX();
             MY = event.clientY - Mouse.GetY();
             TemptW = ImageBg.GetWidth() - CSDiv.GetPixelLeft();
             TemptH =ImageBg.GetHeight()- ((ImageBg.GetHeight()+4) - Math.abs(CSDiv.GetPixelTop()));
            
            if((parseInt(DivW) + MX) < TemptW && (parseInt(DivH) + MX) <= TemptH && (parseInt(DivW) + MX) >= 128 )
            {
             CSDiv.SetWidth(parseInt(DivW) + MX);
             CSDiv.SetHeight(parseInt(DivH) + MX);
           
           
            DrLeft = DLeft+MX;
            DrTop = (DTop+MY);
            imgDrag.SetPixelLeft(DrLeft);
//            imgDrag.SetPixelTop(DrTop);
            }
           
//            window.status="w="+CSDiv.GetWidth()+","+CSDiv.GetHeight()+" h=" + TemptH + "ww="+(parseInt(DivH) + MX);
            return false;
        }
    }


    
    
}
function MovieDon()
{
    if(!document.all)
    {
        return ;
    }
       objectVar= new GetPublicVariable();
      
       if(objectVar.GetSelectPicID().id == event.srcElement.id)
       {
             objectVar.SetState(true);
             ImageSelect = new ColorInfoSelectImage(objectVar.GetSelectPicID());
             imgDrag = new picDrag(objectVar.GetImageDrag());
             ImageBg = new ColorInfoImageBg(objectVar.GetPicBgID());
            
            
             CSDiv = new ColorInfoSelectDiv(objectVar.GetSelectDivID());
             Mouse = new ColorInfoDiYMouse();
                     
             DivLeft = CSDiv.GetPixelLeft();
             DivTop = CSDiv.GetPixelTop();
            
             DLeft = imgDrag.GetPixelLeft();
             DTop = imgDrag.GetPixelTop();
             Domve = new MouseMoves();
             document.οnmοusemοve= Domve.DragImage;
            
       }
      
       if(objectVar.GetImageDrag().id == event.srcElement.id)
       {
              window.status="w="+objectVar.GetImageDrag().id +" h=" + event.srcElement.id;

            objectVar.SetState(true);
            CSDiv = new ColorInfoSelectDiv(objectVar.GetSelectDivID());
            ImageSelect = new ColorInfoSelectImage(objectVar.GetSelectPicID());
            Mouse = new ColorInfoDiYMouse();
            imgDrag = new picDrag(objectVar.GetImageDrag());
            ImageBg = new ColorInfoImageBg(objectVar.GetPicBgID());
           
            DivW = CSDiv.GetWidth();
            DivH = CSDiv.GetHeight();
             
             DLeft = imgDrag.GetPixelLeft();
             DTop = imgDrag.GetPixelTop();
            
             Domve = new MouseMoves();
             document.οnmοusemοve= Domve.Resize; 
       }

}

function oKForfexImg()
{
    objectVar= new GetPublicVariable();
    ImageBg = new ColorInfoImageBg(objectVar.GetPicBgID());
     CSDiv = new ColorInfoSelectDiv(objectVar.GetSelectDivID());
     TemptLeft = CSDiv.GetPixelLeft();
     TemptTop = ((ImageBg.GetHeight()+4) - Math.abs(CSDiv.GetPixelTop()));
     w = CSDiv.GetWidth();
     h = CSDiv.GetHeight();
     id = objectVar.HiddenFieldID();
     id.value= w + "|"+ h +"|"+ TemptLeft +"|" +TemptTop;
     return false;
}

function FolderDispose()
{
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   this.DelFolder = function(FolderName)
   {
        alert(FolderName);
   }
   this.CreateFolder = function(Path)
   {
    fso.CreateFolder(Path);
   }

}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值