Categories | Question details Back To List | ||
onMouseOver and pointer position I'm trying to obtain the pointer position (X & Y) when using the onMouseOver event, however I'm getting and error which says that the event 'e' is undefined. Here's an extract of the code: grid.attachEvent("onMouseOver",function(id,ind){ var node_level = parseInt(grid.getLevel(id)); if((node_level != 4) || (ind != 0)) { hideFloatingDetails(); }else{ var posx = 0; var posy = 0; if (!e) var e = window.event; if (e.pageX || e.pageY) { posx = e.pageX; posy = e.pageY; } else if (e.clientX || e.clientY) { posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop; } detailDiv=document.getElementById(theDiv); detailDiv.style.left=posx+10+"px"; detailDiv.style.top=posy+10+"px"; showFloatingDetails(); } }) Answer posted by Support on Jan 27, 2009 09:02 Actually native html event object is not defined inside custom onMouseOver event handler. To obtain it you need customize next line in dhtmlxgrid.js if (!this.grid.callEvent("onMouseOver", [ r.idd, c._cellIndex ])) replaced with if (!this.grid.callEvent("onMouseOver", [ r.idd, c._cellIndex, e ])) after that you can use in your custom code grid.attachEvent("onMouseOver",function(id,ind,e){ ... Answer posted by Mark W on Jan 28, 2009 00:46 That's great. Thank you. |