SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Carlsbad, California, United States
    15 Post(s)
    0 Thread(s)

    I need a JS IE6 :hover on a class name rather than an element please?


    I need a JS IE6 :hover on a class name rather than an element please? I already have a script that shows :hover on any element within a certain div.

    function sfHover(el) {
      var sfEls = document.getElementById("content").getElementsByTagName(el);
      for (var ii=0; ii<sfEls.length; ii++) {
        sfEls[ii].onmouseover=function() {
          this.className+=" hover";
        sfEls[ii].onmouseout=function() {
          this.className=this.className.replace(new RegExp(" hover\\b"), "");
    function sfStart() {
    if (window.attachEvent) window.attachEvent("onload", sfStart);
    And then this goes in my CSS 
    p:hover, p.hover {
    	background: #999;
    But now I need it to show a hover effect on a class name instead. Is this possible? I know of class name solutions in conjunction with JS library's. But is there an independent solution? I need to target the class of .small - thanks!
    Last edited by PicnicTutorials; Aug 29, 2008 at 06:44.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts