EECS 1012 Lecture Notes - Lecture 10: Mouseover
EECS 1012 verified notes
10/11View all
Document Summary
We can use the "this" keyword, because it corresponds to the object that just called the event. Example: window. onload = function() { var box1 = document. getelementbyid("box1"); var box2 = document. getelementbyid("box2"); box1. onclick = changetext; box2. onclick = changetext; } function changetext() { this. innerhtml = "boyah! Abort, blur, change, click, dblclick, error, focus, keydown, keypress, keyup, load, mousedown, mousemove, mouseout, mouseover, mouseup, reset, resize, select, submit, unload, --------some examples of events the click event (onclick) is just one of many events that can be handled. Problem: events are tricky and have incompatibilities across browsers: reasons: fuzzy w3c event specs; ie disobeying web standards; etc. Solution: prototype includes many event-related features and fixes. Event handlers the prototype way to use prototype"s event features, you must attach the handler using the dom element. Pass the event of interest and the function to use as the handler. Handlers must be attached this way for prototype"s event features to work.