1. Get the distance of the scroll bar
var Stop=document.documentelement.scrolltop | | Document.body.scrollTop
2. Get non-inline styles
IE:CURRENTSTYLE[ATTR]
Standard: Getcomputedstyle[attr]
function GetStyle (obj,attr) {
if (Obj.currentstyle) {
return obj.currentstyle[attr];
}else{
Return getComputedStyle (Obj,false) [attr];
}
}
3. Get the Event object
var e = e | | Event
4. Get keyboard information
E.keycode | | E.which
5. Blocking the browser's default behavior
function Prevent (e) {
if (E.preventdefault) {
E.preventdefault ();
}else{
E.returnvalue=false;
}
}
6. Block Event bubbling
E.stoppropagation? E.stoppropagation (): e.cancelbubble=true;
7. Event Monitoring
AddEventListener ()
Attachevent ()
8. Event Unbind
RemoveEventListener ()
DetachEvent ()
9. Get the event source
E.target | | E.srcelement;
Common JS compatibility issues