zoukankan      html  css  js  c++  java
  • 自定义的ToolTip

    var divShow;
    function doShow(divId){
        divShow 
    = divId;
        
    var floatTable = document.all(divShow);
        
    //floatTable.innerHTML=sTable;
        document.all(divShow).style.display="";
        
    //floatTable.style.position="absolute";
        
        
    var x,y;
        x
    =document.body.scrollLeft+event.clientX; 
        y
    =document.body.scrollTop+event.clientY; 
        

        floatTable.style.posTop 
    = y+20;
        floatTable.style.posLeft 
    = x+20;
    }

    function doHiding(divId) {
        document.all(divId).style.display
    ="none";
    }

    function dohide(){
        
    //document.all("divShow").innerHTML="";
        document.all(divShow).style.display="none";
    }

    var activeElements = new Array();
    var activeElementCount = 0;
    var lTop, lLeft;
    var doMove = true;
    var doResize = false;

    function mousedown() {
        
    var mp;
        mp 
    = findMoveable(window.event.srcElement);
        
    if (!window.event.altKey) {
            
    for (i=0; i<activeElementCount; i++{
            
    if (activeElements[i] != mp) {
                activeElements[i].style.borderWidth 
    = "2px";
            }

            }

            
    if (mp) {
            activeElements[
    0= mp;
            activeElementCount 
    = 1;
            mp.style.borderWidth 
    = "4px";
            }
     else {
            activeElementCount 
    = 0;
            }

        }
     else {
            
    if (mp) {
            
    if (mp.style.borderWidth != "4px"{
                activeElements[activeElementCount] 
    = mp;
                activeElementCount
    ++;
                mp.style.borderWidth 
    = "4px";
            }

            }

        }

        window.status 
    = activeElementCount;
        lLeft 
    = window.event.x;
        lTop 
    = window.event.y;
    }

    document.onmousedown 
    = mousedown;

    function mousemove() {
        
    var i, dLeft, dTop;
        
    if (window.event.button == 1{
        sx 
    = window.event.x;
        sy 
    = window.event.y;
        dLeft 
    = sx - lLeft;
        dTop 
    = sy - lTop;
        
    for (i=0; i<activeElementCount; i++{
            
    if (doMove)
            moveElement(activeElements[i], dLeft, dTop);
            
    if (doResize)
            resizeElement(activeElements[i], dLeft, dTop);
        }

        lLeft 
    = sx;
        lTop 
    = sy;
        
    return false;
        }

    }

    function moveElement(mp, dLeft, dTop) {
        
    var e
        e 
    = mp;
        e.style.posTop 
    += dTop;
        e.style.posLeft 
    += dLeft;
    }

    function hide() {
        outIt();
        dohide();
    }

    function resizeElement(mp, dLeft, dTop) {
        
    var e;
        e 
    = mp;
        e.style.posHeight 
    += dTop;
        e.style.posWidth 
    += dLeft;
    }

    function findMoveable(e) {
        
    if (e.moveable == 'true')
        
    return e;
        
    if (e.tagName == "BODY")
        
    return null;
        
    return findMoveable(e.parentElement);
    }

    function findDefinedMoveable(e) {
        
    if ((e.moveable == 'true') || (e.moveable == 'false'))
        
    return e;
        
    if (e.tagName == "BODY")
        
    return null;
        
    return findDefinedMoveable(e.parentElement);
    }

    function rfalse() {
        
    return false;
    }
  • 相关阅读:
    p标签中的文字垂直居中
    前端调试F12
    python之hashlib
    python之__new__()
    python深浅拷贝与赋值
    【Python3之socket编程】
    5月26号 JAVA基础语法 基本运算符
    5月25号 JAVA基础语法 变量 常量 作用域
    5月22号 JAVA基础语法 数据类型
    5月22号 JAVA基础语法 标识符和关键字
  • 原文地址:https://www.cnblogs.com/ding0910/p/820927.html
Copyright © 2011-2022 走看看