...

View Full Version : doing a mouseover within a function



Jacobb123
02-12-2009, 10:32 PM
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?


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>

vwphillips
02-13-2009, 11:12 AM
sfEls[j].onmouseover = function(){ change_el('join','in'); }

Uzbekjon
02-14-2009, 09:48 AM
And it seems like you are closing your unordered list but never opening it again:


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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum