The commonly used method is document.all
if(document.all){
//IE code
}else{
//Others
}
In fact, this is not enough , document.all can distinguish FireFox, but cannot distinguish Opera, because Opera supports document.all.
My current approach is:
var isIE = document.all && window.external;
...
Opera does not support window.external, so this is safer.