|
|
|
Page 2
To give you an idea, I will show some code that displays mouse coordinates when a button is pressed. The following function works for Netscape 6. It calls the function clicked(e) and passes it an event object. The funciton receives the event object and extracts the values of attributes screenX and screenY.
<html>
In case of Internet Explorer 5.0, there is no need to explicitly pass the event object. You can always use the event object - named event - inside any function. Thus, the above code can be modified as shown below. <html>
Registering event handlers is just the first step towards writing web pages that act like web applications. Understanding the event object is the next step. The difference in the event handling model of the two browsers is very annoying and requires extra work to write cross browser code. We will explore further in later articles. Go To Page: 1 2
The copyright of the article The Event Object - Page 2 in JavaScript is owned by . Permission to republish The Event Object - Page 2 in print or online must be granted by the author in writing.
|
|
|
|
|
|
|
|