Creating Custom ToolTips
来源:互联网 发布:黑豹乐队知乎 编辑:程序博客网 时间:2024/05/16 05:04
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>
- Creating Custom ToolTips
- OpenLayers3-8-Custom Tooltips
- Custom Tooltips in WinForm TreeViews
- Custom Tooltips——自定义工具提示
- Creating Custom Portal Modules
- Creating a Custom View
- Creating custom iOS UIButtons
- Creating Custom Views -
- Creating Custom Views
- Creating Custom Listeners
- Editing Creating Custom Listeners
- Creating Custom Views --1.0
- Android Creating Custom Views
- Creating Custom Views
- Creating custom View - Creating a View Class
- v3 Creating Custom Field Types
- Creating a custom data descriptor
- Creating custom objects in JavaScript
- 一个掌握Struts企业级Web开发框架的实例(二)
- 有关文档的实用性要求——来自《文档审核意见-关于xx文档》的摘录
- 一些基础:VC编程经验和错误
- 待读文章
- 常用的操作xml文档的方法
- Creating Custom ToolTips
- DirectX 9高层着色语言介绍1 —— 引言、简单例子、汇编语言和编译对象
- 【转载】科学研究的策略
- 请教各位高手::为什么我的系统不能安装windows 2k/xp ????????
- 心得体会
- DirectX 9高层着色语言介绍2 —— 语言基础(1)
- 每个开发人员现在应该下载的十种必备工具(ZZ)
- DirectX 9高层着色语言介绍3 —— 语言基础(2)
- base想到...