zoukankan      html  css  js  c++  java
  • [转贴]在树中创建自定义的提示

    The TreeView behavior provides a default ToolTip that displays when a user hovers over a TREENODE element. You may want your users to have more specific information than is provided by the default ToolTip (Use +/- to expand/collapse) accessed by the SHOWTOOLTIP attribute. You can accomplish this by creating three simple DHTML functions that use the ONHOVER and ONUNHOVER events to replace the default ToolTip.

    The following sample shows what these methods might look like. The sample uses the TEXT attribute of the TreeNode object as the ToolTip text, but you could customize this to provide any information that you choose.
    // ToolTip functions include starthover(), starttip(), and endtip()
     
        // ToolTip variables
        var myTimer;
        var nodeText;
        var tipX;
        var tipY;

    function starthover()
    {
        var myVal = window.event.treeNodeIndex;
        var myNode = oTree.getTreeNode(myVal);

        nodeText = myNode.getAttribute("text");
        tipX = window.event.clientX + 15;
        tipY = window.event.clientY + 15;

        myTimer = window.setTimeout(starttip, 1000);
    }

    function starttip()
    {
        results1.style.backgroundColor = "infobackground";
        results1.style.position = "absolute";
        results1.style.left = tipX;
        results1.style.top = tipY;
        results1.style.border = "1px solid black";
        results1.innerText = nodeText;

        myTimer = window.setTimeout(endtip, 5000);
    }

    function endtip()
    {
        results1.style.backgroundColor = "";
        results1.innerText = "";
        results1.style.border = "";
        window.clearTimeout(myTimer);
    }
    </HEAD>
        <BODY>
        <mytree:TREEVIEW id="oTree" TREENODESRC="state_city.xml"
        SHOWTOOLTIP="false" ONHOVER="starthover();" ONUNHOVER="endtip();" />
    <!--This DIV is required to display the ToolTips-->
        <DIV id=results1></DIV>
        </BODY>
    </HTML>

  • 相关阅读:
    VC编程规范
    socket编程FTP客户端demo
    Win7下微软拼音等中文输入法默认英文标点解决办法
    <转载>一般筛法和快速线性筛法求素数
    聚类算法的设计与实现
    面试题集锦_7
    面试题集锦_8
    中点画线算法程序
    HTML解析类 ,让你不使用正则也能轻松获取HTML相关元素 C# .NET
    .NET C# 使用S22.Imap.dll接收邮件 并且指定收取的文件夹的未读邮件,并且更改未读准态
  • 原文地址:https://www.cnblogs.com/goody9807/p/188479.html
Copyright © 2011-2022 走看看