jump.js
上传用户:btntkt
上传日期:2021-04-16
资源大小:5296k
文件大小:2k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

DOS

  1. var offsetxpoint=-60 
  2. var offsetypoint=20 
  3. var ie=document.all
  4. var ns6=document.getElementById && !document.all
  5. var enabletip=false
  6. if (ie||ns6)
  7. var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
  8. function ietruebody(){
  9. return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
  10. }
  11. function ddrivetip(thetext, thecolor, thewidth){
  12. if (ns6||ie){
  13. if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
  14. if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
  15. tipobj.innerHTML=thetext
  16. enabletip=true
  17. return false
  18. }
  19. }
  20. function positiontip(e){
  21. if (enabletip){
  22. var curX=(ns6)?e.pageX : event.x+ietruebody().scrollLeft;
  23. var curY=(ns6)?e.pageY : event.y+ietruebody().scrollTop;
  24. //Find out how close the mouse is to the corner of the window
  25. var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
  26. var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20
  27. var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000
  28. //if the horizontal distance isn't enough to accomodate the width of the context menu
  29. if (rightedge<tipobj.offsetWidth)
  30. //move the horizontal position of the menu to the left by it's width
  31. tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
  32. else if (curX<leftedge)
  33. tipobj.style.left="5px"
  34. else
  35. //position the horizontal position of the menu where the mouse is positioned
  36. tipobj.style.left=curX+offsetxpoint+"px"
  37. //same concept with the vertical position
  38. if (bottomedge<tipobj.offsetHeight)
  39. tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
  40. else
  41. tipobj.style.top=curY+offsetypoint+"px"
  42. tipobj.style.visibility="visible"
  43. }
  44. }
  45. function hideddrivetip(){
  46. if (ns6||ie){
  47. enabletip=false
  48. tipobj.style.visibility="hidden"
  49. tipobj.style.left="-1000px"
  50. tipobj.style.backgroundColor=''
  51. tipobj.style.width=''
  52. }
  53. }
  54. document.onmousemove=positiontip