I have a horizontal navigation. When you click a navigation link that has a child menu, this menu pops out to the side and the parent link gets a background-color applied to it. If the navigation link does not have a child menu, you are taken right to the page, but the active link should still get a background-color applied to it.
However, what is happening is, when I click on a childless link, a parent link above it gets the background applied to it instead of the link that was actually clicked. This happens in both IE and FF.
The navigation functions and the onClick functions correctly. However, the style is being applied in the wrong place.
Here's the javascript:
[CODE=javascript]
function secondarymenuTo ggle(name,id) {
var eArray = document.getEle mentsByTagName( 'DIV');
var ele = document.getEle mentById(id);
for (i = 0; i < eArray.length; i++)
{
if (eArray[i].getAttribute(' name') == name)
eArray[i].className="Sec ondaryMenu";
}
if (ele != undefined)
ele.className=" SecondaryMenuAc tive";
}
[/CODE]
Here's the php where it is being put into the page:
[PHP]
$link_before = "<a href=\"".$locat ion_var.$option _link."&cbc=1&u spid=".$option_ id."\" CLASS=\"Seconda ryMenu\">";
$link_after = "</a>";
$onclick = "onclick=\"disp layMenu('".$opt ion_id."', '".$divString." ');\"";
$onclick_toggle = "onclick=\"seco ndarymenuToggle ('levelone','le velone".$levelo ne_counter."'); secondarymenuTo ggle('leveltwo' ,'')\"";
echo "<tr $onclick>\n";
echo "<td><div class=\"Seconda ryMenu\" $onclick_toggle name=\"levelone \" id=\"levelone". $levelone_count er."\">";
echo "<div class=\"Seconda ryMenu\" >".$link_before .$image_var.$li nk_after.$link_ before.$option_ display_value.$ link_after."</div>";
[/PHP]
It seems that maybe the loop is getting mixed up somewhere? I've troubleshot this quite a bit and am not really sure what is happening. If you would like me to better explain the problem, let me know. Unfortunately it is not publicly accessible.
However, what is happening is, when I click on a childless link, a parent link above it gets the background applied to it instead of the link that was actually clicked. This happens in both IE and FF.
The navigation functions and the onClick functions correctly. However, the style is being applied in the wrong place.
Here's the javascript:
[CODE=javascript]
function secondarymenuTo ggle(name,id) {
var eArray = document.getEle mentsByTagName( 'DIV');
var ele = document.getEle mentById(id);
for (i = 0; i < eArray.length; i++)
{
if (eArray[i].getAttribute(' name') == name)
eArray[i].className="Sec ondaryMenu";
}
if (ele != undefined)
ele.className=" SecondaryMenuAc tive";
}
[/CODE]
Here's the php where it is being put into the page:
[PHP]
$link_before = "<a href=\"".$locat ion_var.$option _link."&cbc=1&u spid=".$option_ id."\" CLASS=\"Seconda ryMenu\">";
$link_after = "</a>";
$onclick = "onclick=\"disp layMenu('".$opt ion_id."', '".$divString." ');\"";
$onclick_toggle = "onclick=\"seco ndarymenuToggle ('levelone','le velone".$levelo ne_counter."'); secondarymenuTo ggle('leveltwo' ,'')\"";
echo "<tr $onclick>\n";
echo "<td><div class=\"Seconda ryMenu\" $onclick_toggle name=\"levelone \" id=\"levelone". $levelone_count er."\">";
echo "<div class=\"Seconda ryMenu\" >".$link_before .$image_var.$li nk_after.$link_ before.$option_ display_value.$ link_after."</div>";
[/PHP]
It seems that maybe the loop is getting mixed up somewhere? I've troubleshot this quite a bit and am not really sure what is happening. If you would like me to better explain the problem, let me know. Unfortunately it is not publicly accessible.
Comment