Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2006
    Posts
    311
    Thanks
    0
    Thanked 1 Time in 1 Post

    doing a mouseover within a function

    I have the following code and I cannot seem to get it to work right

    So when the <li class="parent item53"> is hovered over it will invoke the change_el() method but it does not do it. what am I doing wrong?

    Code:
    function sfHover()
    {
     var sfEls = document.getElementsByTagName("LI");
     
     document.
    
     for (var j=0; j< sfEls.length; j++)
     {
    
    
    if(sfEls[j].className=='parent item53'){
    
     
    sfEls[j].innerHTML = '<span id= "join")"><a  href="/clients/uwin/index.php?option=com_content&amp;view=category&amp;layout=blog&amp;id=29&amp;Itemid=53"><span>Join the Campaign</span></a></span><ul><li class="item61"><a href="/clients/uwin/index.php?option=com_content&amp;view=article&amp;id=20&amp;Itemid=61"><span>Partner Benefits</span></a></li><li class="item62"><a href="/clients/uwin/index.php?option=com_content&amp;view=archive&amp;Itemid=62"><span>Donation</span></a></li><li class="item63"><a href="/clients/uwin/index.php?option=com_content&amp;view=archive&amp;Itemid=63"><span>Merchandising</span></a></li><li class="item64"><a href="/clients/uwin/index.php?option=com_content&amp;view=archive&amp;Itemid=64"><span>Donation Form</span></a></li><li class="item65"><a href="/clients/uwin/index.php?option=com_content&amp;view=archive&amp;Itemid=65"><span>Email Update</span></a></li><li class="item66"><a href="/clients/uwin/index.php?option=com_content&amp;view=archive&amp;Itemid=66"><span>Feedback</span></a></li></ul>';
    
    sfEls[j].className.onMouseover = change_el('join','in')
    
    }
      
     } 
    
    
    }
    
    function change_el(element,type){
    alert("jake");
    
    if(type=='in'){
    document.getElementById("join").style.position = "relative";
    document.getElementById("join").style.left = "50px";
    
    }
    
    if(type == 'out'){
    document.getElementById("join").style.position = "relative";
    document.getElementById("join").style.left = "-50px";
    }
    
    
    }
    //if (window.attachEvent) window.attachEvent("onload", sfHover);
    
    </script>

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,504
    Thanks
    3
    Thanked 501 Times in 488 Posts
    Code:
    sfEls[j].onmouseover = function(){ change_el('join','in'); }
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • #3
    New Coder
    Join Date
    Feb 2009
    Location
    Uzbekistan
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts
    And it seems like you are closing your unordered list but never opening it again:

    Code:
    view=archive&amp;Itemid=66"><span>Feedback</span></a></li></ul>';


  •  

    Posting Permissions

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