[ Index ] |
|
Code source de Horde 3.1.3 |
1 /** 2 * Horde Tooltip Javascript 3 * 4 * Provides the javascript to display tooltips. 5 * 6 * $Horde: horde/js/tooltip.js,v 1.2.10.2 2005/05/01 16:53:30 chuck Exp $ 7 * 8 * See the enclosed file COPYING for license information (LGPL). If you 9 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. 10 */ 11 12 var activeTimeout; 13 14 if (typeof document.captureEvents != 'undefined') { 15 document.captureEvents(Event.MOUSEMOVE); 16 document.onmousemove = mousePos; 17 var netX, netY; 18 } 19 20 function posX() 21 { 22 tempX = document.body.scrollLeft + event.clientX; 23 if (tempX < 0) { 24 tempX = 0; 25 } 26 return tempX; 27 } 28 29 function posY() 30 { 31 tempY = document.body.scrollTop + event.clientY; 32 if (tempY < 0) { 33 tempY = 0; 34 } 35 return tempY; 36 } 37 38 function mousePos(e) 39 { 40 netX = e.pageX; 41 netY = e.pageY; 42 } 43 44 function tooltipShow(pX, pY, src) 45 { 46 if (pX < 1) { 47 pX = 1; 48 } 49 if (pY < 1) { 50 pY = 1; 51 } 52 if (document.getElementById) { 53 tt = document.getElementById('tooltip'); 54 tt.style.left = pX + 'px'; 55 tt.style.top = pY + 'px'; 56 tt.style.visibility = 'visible'; 57 tt.innerHTML = src; 58 } else { 59 document.all.tooltip.style.left = pX + 'px'; 60 document.all.tooltip.style.top = pY + 'px'; 61 document.all.tooltip.style.visibility = 'visible'; 62 document.all.tooltip.innerHTML = src; 63 } 64 } 65 66 function tooltipClose() 67 { 68 if (document.getElementById) { 69 tt = document.getElementById('tooltip'); 70 tt.style.visibility = 'hidden'; 71 tt.innerHTML = ''; 72 } else { 73 document.all.tooltip.style.visibility = 'hidden'; 74 document.all.tooltip.innerHTML = ''; 75 } 76 clearTimeout(activeTimeout); 77 window.status = ''; 78 } 79 80 function tooltipLink(tooltext, statusline) 81 { 82 text = '<div class="tooltip">' + tooltext + '</div>'; 83 if (typeof document.captureEvents != 'undefined') { 84 xpos = netX; 85 ypos = netY; 86 } else { 87 xpos = posX(); 88 ypos = posY(); 89 } 90 activeTimeout = setTimeout('tooltipShow(xpos - 110, ypos + 15, text);', 300); 91 window.status = statusline; 92 } 93 94 document.write('<div id="tooltip" style="position:absolute; visibility:hidden;"></div>');
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |