if(navigator.userAgent.indexOf("MSIE 7") > 0) { // IE 7.x } else if(navigator.userAgent.indexOf("MSIE 8") > 0) { // IE 8.x } else { }