351Chapter 15Generic (Web server application) HTML Element ObjectsIE4+ and W3C browsers

351Chapter 15Generic HTML Element ObjectsIE4+ and W3C browsers simplify the implementation of this kind of three-state image buttonby allowing you to assign the event handlers directly to imgelement objects. Wrappingimages inside links is a backward-compatibility approach that allows older browsers torespond to clicks on images for navigation or other scripting tasks. Related Item:onclickevent handler. onmouseenteronmouseleaveCompatibility:WinIE5.5+, MacIE-, NN-, Moz-, Safari- WinIE5.5 introduced the onmouseenterand onmouseleaveevent handlers. Both event han- dlers operate just like the onmouseoverand onmouseoutevent handlers, respectively. Microsoft simply offers an alternate terminology. The old and new events continue to fire inIE5.5+. The old ones fire just before the new ones for each act of moving the cursor atop, andexiting from atop, the object. If you are scripting exclusively for IE5.5+, you should use thenew terminology; otherwise, stay with the older versions. ExampleYou can modify Listing 15-43 with the IE5.5 syntax by substituting onmouseenterforonmouseoverand onmouseleavefor onmouseout. The effect is the same. Related Items:onmouseover, onmouseoutevent handlers. onmousemoveCompatibility:WinIE4+, MacIE4+, NN4+, Moz1+, Safari1+ The onmousemoveevent handler fires whenever the cursor is atop the current object and themouse is moved, even by a single pixel. You do not have to press the mouse button for theevent to fire, although the event is most commonly used in element dragging especially inNN/Mozilla, where no ondragevent handler is available. Even though the granularity of this event can be at the pixel level, you should not use thenumber of event firings as a measurement device. Depending on the speed of cursormotion and the performance of the client computer, the event may not fire at every pixellocation. In NN4, you cannot assign the onmousemoveevent handler to any object by way of tagattributes. But you can use the NN4 event capturing mechanism to instruct (via scripting) a window, document, or layerobject to capture mouseMoveevents. This allows for NN4scripts to produce positioned element (layer) dragging. In IE4+ and W3C DOM-compatiblebrowsers, however, you can assign the onmousemoveevent handler to any element(although you can drag only with positioned elements). When designing a page thatencourages users to drag multiple items on a page, it is most common to assign theonmousemoveevent handler to the documentobject and let all such events bubble up tothe document for processing. ExampleSee Chapters 39 and 56 on the CD-ROM for examples of using mouse events to control ele- ment dragging on a page. Related Items:ondrag, onmousedown, onmouseupevent handlers. elementObject.onmousemove