JK Web Studio is a small web design studio, specializing in efficient and user friendly solutions.

Contact us at info@jkwebstudio.com

Archive for June, 2009

Detect IE7 in JS

Tuesday, June 30th, 2009

if (window.XMLHttpRequest) {
// IE 7, mozilla, safari, opera 9
} else {
// IE6, older browsers
}

Using JavaScript to read CSS from external file

Tuesday, June 30th, 2009

function get_style( obj, cssprop ){
if (obj.currentStyle){ // IE
return obj.currentStyle[cssprop];
}else if (document.defaultView && document.defaultView.getComputedStyle){ // DOM
return document.defaultView.getComputedStyle(obj, “”)[cssprop];
}else{ // get inline style
return obj.style[cssprop];
}
}