This is my own little script I whipped together once, works for me :)

function iePNG() {
var images = document.getElementsByTagName("img");
if (images[0].style.filter != null) {
var src;
for (var i = 0; i < images.length; i++) {
src = "">
if (src.indexOf(".png") > 0) {
images[i].src = "";
images[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='')";
}
}
}
}

I don't really understand why you need all those complex span solutions and such, but if there's something wrong with my code I'd very much appreciate the feedback.
btw, the blank.gif is a transparent 1*1 gif.

Andreas

On Jun 19, 2006, at 23:16 , Sam wrote:

Ken,

Thanks for the snippet.  It was so short even I could understand the code.

Here's a snippet to modify the filename on mouseover / mouseout for pngs in IE or whatever browser.  IT checks for the filter style and if present, modifies that attribute, not the src attribute.


function pngHover(event) {
 if(event.type == 'mouseover')  {
  if(this.style.filter) // add -hover to filename on mouseover
   this.style.filter = this.style.filter.replace('.png', '-hover.png');
  else
   this.src = "" '-hover.png');
 } else {
  if(this.style.filter) // remove -hover from filename on mouseout
   this.style.filter = this.style.filter.replace('-hover.png', '.png');
  else
   this.src = "" '.png');
 }
}

 
_______________________________________________
Rails-spinoffs mailing list

_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to