Hi Folk
Just a bit of help here for newbies who want their menus to look nicer.
I am sure that many of you make menus like this
<ul id="menu">
<li><a href="page1.htm l">option 1</a></li>
<li><a href="page2.htm l">option 2</a></li>
<li><a href="page3.htm l">option 3</a></li>
<li><a href="page4.htm l">option 4</a></li>
</ul>
and then add style like this
#menu li:hover {background-color: #123456;}
Below is a little function I "developed" (stole, copied and adapted) that
can create this hover effect in IE.
To make it work, write the body tag as follows:
<body onload="hoverer ('menu');">
function hoverer(ulname) {
if (document.all && document.getEle mentById(ulname ).currentStyle ) {
var navroot = document.getEle mentById(ulname );
var lis=navroot.get ElementsByTagNa me("li");
for (i=0; i<lis.length; i++) {
var oldClassName = this.className;
lis[i].onmouseover=fu nction() {this.className = ulname + "ie";}
lis[i].onmouseout=fun ction() {this.className = oldClassName;}
}
}
}
any comments / questions greatly appreciated.
- Nicolaas
Just a bit of help here for newbies who want their menus to look nicer.
I am sure that many of you make menus like this
<ul id="menu">
<li><a href="page1.htm l">option 1</a></li>
<li><a href="page2.htm l">option 2</a></li>
<li><a href="page3.htm l">option 3</a></li>
<li><a href="page4.htm l">option 4</a></li>
</ul>
and then add style like this
#menu li:hover {background-color: #123456;}
Below is a little function I "developed" (stole, copied and adapted) that
can create this hover effect in IE.
To make it work, write the body tag as follows:
<body onload="hoverer ('menu');">
function hoverer(ulname) {
if (document.all && document.getEle mentById(ulname ).currentStyle ) {
var navroot = document.getEle mentById(ulname );
var lis=navroot.get ElementsByTagNa me("li");
for (i=0; i<lis.length; i++) {
var oldClassName = this.className;
lis[i].onmouseover=fu nction() {this.className = ulname + "ie";}
lis[i].onmouseout=fun ction() {this.className = oldClassName;}
}
}
}
any comments / questions greatly appreciated.
- Nicolaas
Comment