Saturday, February 19, 2011

JavaScript: onMouseOver Event Not Working Properly With Other Events

Programmer Question

Hello,



I have a HTML webpage that contains a 15x15 table and I also have a small square div that follows the mouse when you press and hold the left mouse button on the div.



I have assigned an onmouseover event to the 15x15 table so that when the mouse hovers over a cell, a variable called "gridPlacement" is set the value of the unique id of the table cell the mouse hovered over.



The onmouseover event seems to work fine and instantly as soon as you hover over a cell the variable "gridPlacement" is set to the cell's id.



But when the onmousedown and onmousemove events are triggered (when the mouse presses and holds the left mouse button on the div I mentioned earlier), sometimes when you hover over a cell the variable "gridPlacement" isn't set, and sometimes you have to move your mouse over the cell a few times for it to work.



It seems the onmousedown and onmousemove events seem to have an impact on the onhover event on my 15x15 table.



Does anybody know why this happens and how I can work around this problem?



I hope you understand me, I've tried to explain my problem as best as I can.



Find the answer here

1 comment:

  1. Hi,Website Builders Design, a Graphic Design Business based on several workers, each only working in their own specialty with Web Design Cochin. So it does not matter of you want a website built or redesigned, a greeting card designed, a gay wedding invitation, or a large database driven tourism directory, you only work with the one expert.Thanks..........

    ReplyDelete

LinkWithin

Related Posts with Thumbnails