1 | /*********************************************** |
||
2 | * Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com) |
||
3 | * This notice MUST stay intact for legal use |
||
4 | * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code |
||
5 | ***********************************************/ |
||
6 | |||
7 | var offsetxpoint=-25 //Customize x offset of tooltip |
||
8 | var offsetypoint=-45 //Customize y offset of tooltip |
||
9 | var ie=document.all |
||
10 | var ns6=document.getElementById && !document.all |
||
11 | var enabletip=false |
||
12 | if (ie||ns6) |
||
13 | var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : "" |
||
14 | |||
15 | function ietruebody(){ |
||
16 | return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body |
||
17 | } |
||
18 | |||
19 | function ddrivetip(thetext, thecolor, thewidth){ |
||
20 | if (ns6||ie){ |
||
0 ignored issues
–
show
|
|||
21 | if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px" |
||
22 | if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor |
||
23 | tipobj.innerHTML=thetext |
||
24 | enabletip=true |
||
25 | return false |
||
26 | } |
||
27 | } |
||
28 | |||
29 | function positiontip(e){ |
||
30 | if (enabletip){ |
||
31 | var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft; |
||
32 | var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop; |
||
33 | //Find out how close the mouse is to the corner of the window |
||
34 | var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20 |
||
35 | var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20 |
||
36 | |||
37 | var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000 |
||
38 | |||
39 | //if the horizontal distance isn't enough to accomodate the width of the context menu |
||
40 | if (rightedge<tipobj.offsetWidth) |
||
41 | //move the horizontal position of the menu to the left by it's width |
||
42 | tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px" |
||
43 | else if (curX<leftedge) |
||
44 | tipobj.style.left="5px" |
||
45 | else |
||
46 | //position the horizontal position of the menu where the mouse is positioned |
||
47 | tipobj.style.left=curX+offsetxpoint+"px" |
||
48 | |||
49 | //same concept with the vertical position |
||
50 | if (bottomedge<tipobj.offsetHeight) |
||
51 | tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px" |
||
52 | else |
||
53 | tipobj.style.top=curY+offsetypoint+"px" |
||
54 | tipobj.style.visibility="visible" |
||
55 | } |
||
56 | } |
||
57 | |||
58 | function hideddrivetip(){ |
||
59 | if (ns6||ie){ |
||
60 | enabletip=false |
||
61 | tipobj.style.visibility="hidden" |
||
62 | tipobj.style.left="-1000px" |
||
63 | tipobj.style.backgroundColor='' |
||
64 | tipobj.style.width='' |
||
65 | } |
||
66 | } |
||
67 | document.onmousemove=positiontip |
||
68 |
This check looks for functions where a
return
statement is found in some execution paths, but not in all.Consider this little piece of code
The function
isBig
will only return a specific value when its parameter is bigger than 5000. In any other case, it will implicitly returnundefined
.This behaviour may not be what you had intended. In any case, you can add a
return undefined
to the other execution path to make the return value explicit.