View Single Post
Old Sep 15th, 2006, 7:05 AM   #4
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 4 Arevos is on a distinguished road
Check out the Prototype javascipt framework. It's widely used, available as a single js file, and adds a number of extensions to the basic Javascript library, including functions to handle forms, element positioning, classes and functional programming.

In your case, the Position.within function would seem to be the one to use. Perhaps something like:
javascript Syntax (Toggle Plain Text)
  1. if (!Position.within($('my_image_id'), event.x, event.y))
  2. // mouse cursor no longer within image with id of 'my_image_id'
Note that the above code isn't tested; it's just to give you an idea of what I mean.

Also note that $() is a wrapper around document.getElementById() provided by Prototype.
Arevos is offline   Reply With Quote