you are here: codestackercodes [RSS] → tag ie6 [RSS]

ie 6 and 7 selectors hack

* html #selector {property:value;} /* Only IE6 and lower will see this */
*+html #selector {property:value;} /* Only IE7 will see this */

hover for ie 6

/* IE6 - pseudo class :hover */ 
$(document).ready(function(){ 
	if(jQuery.browser.msie && jQuery.browser.version<7){ 
		$('[class*="bla"]').hover( 
		function () { 
			$(this).addClass('hover'); 
		}, 
		function () { 
			$(this).removeClass('hover'); 
		} 
		); 
	} 
});

[prototype] adding input:focus functionality to ie

Event.observe(window, 'load', function() { 
var fields = $$("input"); 
for (var i = 0; i fields[i].onfocus = function() {this.className += ' focused';} 
fields[i].onblur = function() {this.className = this.className.replace('focused', '');} 
} 
}); 

// in css, paste

// input:focus, /* works in FF without javascript */ 

// input.focused /* used by js */ 

// { background-color: #f7cd72; } 

another ie 6 hack

p {			
	background: green !important; /* Major browsers other than IE 6 and below respect the importance immediately */
	background: red; /* IE 6 and below use this value instead, even though the above was marked as important */
}

1kb ie 6 png fix hack

create a 1x1 'clear.gif' image

var clear="images/clear.gif" //path to clear.gif


pngfix=function(){var els=document.getElementsByTagName('*');var i_p=/\.png/i;var i=els.length;while (i-- >0){var el=els[i];var es=el.style;if(el.src&&el.src.match(i_p)&&es.filter==''){el.height = el.height;el.width = el.width;es.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')";el.src = clear;}else{var elb=el.currentStyle.backgroundImage;if(elb.match(i_p)){var path=elb.split('"');var rep=(el.currentStyle.backgroundRepeat=='no-repeat')?'crop':'scale';es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')";es.height=el.clientHeight+'px';es.backgroundImage="none";}}if (el.currentStyle.position!='absolute' && !es.filter && !el.tagName.match(/(body|html|script)/gi)) es.position="relative";if (es.filter&&el.currentStyle.position=="relative") es.position="static";}}
window.attachEvent('onload',pngfix);
Displaying all 5 Code