I cannot for the life of me get this code to work properly in any browser! (Though I'm closer thanks to help on this forum) All I have been trying to achieve the last 2 days is to get the addStyleDiv function to only call the addStyle function when it sees that it is mousing out of the div with id='rollover'
That is, not call addStyle on the elements within the div, only when it is completely outside of the rollover div. Right now, every element within the rollover div triggers the onmouseout event except mousing out of the actual rollover div. (the exact opposite of what I want) I would like this to work on all mainstream browsers, so please let me know if my code will only work with some (and how to fix it).
Latest html:
Code:
<div id="rollover" onmouseout="addStyleDiv(event,'feat_main');">
<ul id="featured">
<li class="medical" onmouseover="addStyle('feat_medical');"><a href="equipment/medical">Medical</a></li>
<li class="fabrication" onmouseover="addStyle('feat_fabrication');"><a href="services/metal_fabrication">Fabrication</a></li>
<li class="capsnap" onmouseover="addStyle('feat_capsnap');"><a href="equipment/capsnap">CapSnap™</a></li>
<li class="hurricane" onmouseover="addStyle('feat_hurricane');"><a href="equipment/parts_washing/hurricane">Hurricane</a></li>
<li class="media" onmouseover="addStyle('feat_media');"><a href="video">Media</a></li>
</ul>
<div id="flyout" >
<ul id="feat_main">
<h1>Midbrook</h1>
standard page no rollover
</ul>
<ul id = feat_medical>
<h1>Medical</h1>
</ul>
<ul id = feat_fabrication>
<h1>Fabrication</h1>
</ul>
<ul id = feat_capsnap>
<h1>CapSnap</h1>
</ul>
<ul id="feat_hurricane">
<h1>Hurricane</h1>
</ul>
<ul id = feat_media>
<h1>Media</h1>
</ul>
</div>
</div>
latest JS functions:
Code:
function addStyleDiv(e, x)
{
if (!e) var e = window.event;
var tg=(window.event) ? e.srcelement : e.target;
if (tg.id != 'rollover')
{
alert('leaving '+tg.tagName + ' '+tg.id);
return;
}
/*These next two lines are NEVER reached no matter what*/
alert('It must have finally seen rollover');
addStyle('feat_main');
}
function addStyle(x){
removeAllStyle();
document.getElementById(x).style.display="block";
}
function removeAllStyle()
{
removeStyle('feat_main');
removeStyle('feat_hurricane');
removeStyle('feat_fabrication');
removeStyle('feat_capsnap');
removeStyle('feat_medical');
removeStyle('feat_media');
}
Thanks so much in advance. I'm dying to have this working.
__________________
Luke Robinson
Please login or register to view this content. Registration is FREE
Last edited by lrobinson; 08-18-2009 at 07:36 PM..
Reason: the tab key put the submit button in focus. oops :-)
|