Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using document.onmousemove to follow mouse position

Status
Not open for further replies.

dhossbach

Technical User
Apr 16, 2002
13
0
0
FR
I created my online store almost entirely with Javascript at the following adress : It works fine with MSIE4.5/5/5.5 but from time to time visitors report script errors with MSIE.
I suspect that the reason could be the use of the document.onmousemove object. I found it in a script, but it's not mentionned in any book. I use it to make the Html table follow the mouse.
I use it as follow in my script :

document.onmousemove = aide_souris;

where aide_souris is the following function :

function aide_souris() {
x = event.x + document.body.scrollLeft - 40;
y = event.y + document.body.scrollTop + 20;
if (x < 0) x = 0;
plan_aide.style.left = x;
plan_aide.style.top = y;
}

Is there perhaps a better way to process the mouse position ? Is something wrong with the use of the document.onmousemove object ?
Being an occasionnal programmer, I would appreciate some help.

Detlef
 
As an aside - how have you got around the problem of the mouse slipping off? Or is this not click and drag?
 
I use it mostly with the onmouseover statement for comment boxes, the box moves with the mouse as long as you are on the link. But I use it also to buy an item by clicking on the image, release the mouse button and drag the image into the shopping card, you can do this as many times as items you want. You can also remove items from the shopping card the same way. The shopping card dispayed in the top left of the page is instantly updated and a checkbox indicates that this item is already ordered. You can also instantly edit the quantity selected. If you have MSIE5 you can try it at the following address with a vitamin bottle :

(allow some time to load)

I believe it is very important to be able to manipulate instantly data in the shopping card. But it must always work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top