el-roboto
04-05-2007, 05:52 AM
Hello
The main navigation on this site I'm working on uses a list for the main navigation, where the list tags each have a unique class to render them as different 'button's - each of these classes has unique image is specified in the background:; property.
There is a mouseover effect on the navigation buttons which is achieved using a javascript code which changes an elements class (by referencing the id) hence the li tags have both class and id.
Within the <li> tags is an anchor. Within the anchor is a text alternative to the button with a span class which states display:block; and visibility:hidden;
The idea is that the navigation buttons have a mouseover effect which works cross browser, and successfully link to the desired pages.
The problem is with IE (6) on PC: The mouseover effects work fine but the anchored text isn't being recognised, so if you click on a button, it goes nowhere.
Im baffled as to why so I hope you can help. here's the code involved.
A SNIPPET OF THE NAV IN HTML
<ul class="egomenu">
<li id="MENU1" class="egohome"><a href="somewhere/" accesskey="1" title="HOME"><span class="hiddenNav">HOME</span></a></li>
<li id="MENU2" class="egofun"><a href="somewhere/" accesskey="2" title="FUN"><span class="hiddenNav">FUN</span></a></li>
<li id="MENU3" class="egoshop"><a href="somewhere/" accesskey="3" title="SHOP"><span class="hiddenNav" >SHOP</span></a></li></ul>
A SNIPPET OF THE CSS
.egohome {display:inline; float: left; width: 52px; height:19px; background: url(../img/navhome.jpg) top left no-repeat;margin:0; padding:0; cursor:pointer;}
.egohome-on {display:inline; float: left; width: 52px; height:19px; background: url(../img/navhome-on.jpg) top left no-repeat;margin:0; padding:0; cursor:pointer;}
.egofun {display:inline; float: left; width: 46px; height:19px; background: url(../img/navfun.jpg) top left no-repeat;margin:0; padding:0; cursor:pointer;}
.egofun-on {display:inline; float: left; width: 46px; height:19px; background: url(../img/navfun-on.jpg) top left no-repeat;margin:0; padding:0; cursor:pointer;}
.egoshop {display:inline; float: left; width: 53px; height:19px; background: url(../img/navshop.jpg) top left no-repeat;margin:0; padding:0; cursor:pointer;}
.egoshop-on {display:inline; float: left; width: 53px; height:19px;background: url(../img/navshop-on.jpg) top left no-repeat;margin:0; padding:0; cursor:pointer;}
.hiddenNav{display:block; visibility:hidden; height:19px;}
SNIPPET OF JS
function changeClass( idref, classname ) {
var el = document.getElementById(idref);
var attributeNode = el.getAttributeNode("class");
if( attributeNode ) { attributeNode.value = classname; }
else { el.setAttribute("class", classname); }
}
window.onload = function(){
var MENU1 = document.getElementById('MENU1');
MENU1.onmouseover = function(){changeClass('MENU1','egohome-on');};
MENU1.onmouseout = function(){changeClass('MENU1','egohome');};
var MENU2 = document.getElementById('MENU2');
MENU2.onmouseover = function(){changeClass('MENU2','egofun-on');};
MENU2.onmouseout = function(){changeClass('MENU2','egofun');};
var MENU3 = document.getElementById('MENU3');
MENU3.onmouseover = function(){changeClass('MENU3','egoshop-on');};
MENU3.onmouseout = function(){changeClass('MENU3','egoshop');}; }
:confused: :confused:
The main navigation on this site I'm working on uses a list for the main navigation, where the list tags each have a unique class to render them as different 'button's - each of these classes has unique image is specified in the background:; property.
There is a mouseover effect on the navigation buttons which is achieved using a javascript code which changes an elements class (by referencing the id) hence the li tags have both class and id.
Within the <li> tags is an anchor. Within the anchor is a text alternative to the button with a span class which states display:block; and visibility:hidden;
The idea is that the navigation buttons have a mouseover effect which works cross browser, and successfully link to the desired pages.
The problem is with IE (6) on PC: The mouseover effects work fine but the anchored text isn't being recognised, so if you click on a button, it goes nowhere.
Im baffled as to why so I hope you can help. here's the code involved.
A SNIPPET OF THE NAV IN HTML
<ul class="egomenu">
<li id="MENU1" class="egohome"><a href="somewhere/" accesskey="1" title="HOME"><span class="hiddenNav">HOME</span></a></li>
<li id="MENU2" class="egofun"><a href="somewhere/" accesskey="2" title="FUN"><span class="hiddenNav">FUN</span></a></li>
<li id="MENU3" class="egoshop"><a href="somewhere/" accesskey="3" title="SHOP"><span class="hiddenNav" >SHOP</span></a></li></ul>
A SNIPPET OF THE CSS
.egohome {display:inline; float: left; width: 52px; height:19px; background: url(../img/navhome.jpg) top left no-repeat;margin:0; padding:0; cursor:pointer;}
.egohome-on {display:inline; float: left; width: 52px; height:19px; background: url(../img/navhome-on.jpg) top left no-repeat;margin:0; padding:0; cursor:pointer;}
.egofun {display:inline; float: left; width: 46px; height:19px; background: url(../img/navfun.jpg) top left no-repeat;margin:0; padding:0; cursor:pointer;}
.egofun-on {display:inline; float: left; width: 46px; height:19px; background: url(../img/navfun-on.jpg) top left no-repeat;margin:0; padding:0; cursor:pointer;}
.egoshop {display:inline; float: left; width: 53px; height:19px; background: url(../img/navshop.jpg) top left no-repeat;margin:0; padding:0; cursor:pointer;}
.egoshop-on {display:inline; float: left; width: 53px; height:19px;background: url(../img/navshop-on.jpg) top left no-repeat;margin:0; padding:0; cursor:pointer;}
.hiddenNav{display:block; visibility:hidden; height:19px;}
SNIPPET OF JS
function changeClass( idref, classname ) {
var el = document.getElementById(idref);
var attributeNode = el.getAttributeNode("class");
if( attributeNode ) { attributeNode.value = classname; }
else { el.setAttribute("class", classname); }
}
window.onload = function(){
var MENU1 = document.getElementById('MENU1');
MENU1.onmouseover = function(){changeClass('MENU1','egohome-on');};
MENU1.onmouseout = function(){changeClass('MENU1','egohome');};
var MENU2 = document.getElementById('MENU2');
MENU2.onmouseover = function(){changeClass('MENU2','egofun-on');};
MENU2.onmouseout = function(){changeClass('MENU2','egofun');};
var MENU3 = document.getElementById('MENU3');
MENU3.onmouseover = function(){changeClass('MENU3','egoshop-on');};
MENU3.onmouseout = function(){changeClass('MENU3','egoshop');}; }
:confused: :confused: