Image.handleEvent()

JavaScript 1.2+, Nav4+ Syntax

							image.handleEvent(event)

Description

The handleEvent() method provides a way to invoke an image's event handler, even though the event never happened. The event argument associated with this method can be any of the events handled by the Image object.

Example

Listing 7.304 shows how to force an image to handle a KEYDOWN event.

Listing 7.304 The handleEvent() Method
<img name="circle" src="circle.gif" onKeyDown="alert('Key pressed')">

<script language="JavaScript">
<!-- Hide
document.circle.handleEvent(Event.KEYDOWN);
//Hide End --->
</script>
							
						

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.