SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
-
Jul 8, 2008, 17:37 #1
- Join Date
- Dec 2007
- Location
- Carlsbad, California, United States
- Posts
- 3,658
- Mentioned
- 15 Post(s)
- Tagged
- 0 Thread(s)
Question about Suckerfish IE6 Hover?
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?
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);
-
Jul 8, 2008, 18:32 #2
- Join Date
- Apr 2007
- Posts
- 1,205
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Will Array.concat() work on the NodeList returned by getElementsByTagName()?
Code:var sfEls = document.getElementById("content").getElementsByTagName("input"); var sfEls2 = document.getElementById("content").getElementsByTagName("textarea"); sfEls = sfEls.concat(sfEls2); sfEls2 = null;
-
Jul 8, 2008, 21:23 #3
- Join Date
- Dec 2007
- Location
- Carlsbad, California, United States
- Posts
- 3,658
- Mentioned
- 15 Post(s)
- Tagged
- 0 Thread(s)
Thanks World Wide Weird! However, JS is not my strong suit. Can you possibly show me how that would piece together with the script that I'm currently working with? Then I'll give it a try. Thanks man - appreciate it!
Bookmarks