PDA

View Full Version : Question about Suckerfish IE6 Hover?



ewwatson
07-09-2008, 12:54 PM
So... the below code makes the "input" hover in IE6. How do I add a textarea hover to that as well? The only way I found was to copy/paste the code all over again (a duplicate) and put in "textarea" instead of input. But that's double the amount of code - there's got to be a way to combine them right? Thanks! :)

sfHover = function() {
var sfEls = document.getElementById("content").getElementsByTagName("input");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+=" hover";
}
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" hover\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);