[Javascript] What was last rollover?
Roger Roelofs
rer at datacompusa.com
Thu Oct 4 15:42:50 CDT 2007
Terry,
On Oct 4, 2007, at 4:02 PM, Terry Riegel wrote:
>>> I have three images on a web page with a css rollover condition,
>>> such as:
>>>
>>> img1:hover ------8<-----
>>>
>>> If the user moves his/her cursor over an image, then the border's
>>> corresponding color changes -- no problems there.
>>>
>>> But, how can I determine which image was subject to the *last*
>>> rollover?
>>
>> I don't think this info is stored anywhere. You can fake it with
>>
>> var lastHover
>>
>> <img ... onmouseover="lastHover = this;">
>
> May not account for images that intersect each other.
As usual you are correct. The following is a bit more robust, but
not fool-proof.
<img ... onmouseover="lastHover = this;" onmouseout="lastHover = this;">
I confess I feel a twinge of guilt every time I write an inline
javascript example. It's so handy for a short example, but such a
pain to maintain long term. Some of the other examples in this
thread, tho more verbose, are much better expressions of maintainable/
reusable js.
Roger
--
Roger Roelofs web www.datacompusa.com
Datacomp Appraisal Services Email rer at datacompusa.com
3215 Eaglecrest Drive, NE
Grand Rapids, MI 49525-4593
More information about the Javascript
mailing list