5
50295
Hi everyone,
This one is better experienced than explained, so I'm including a code
sample below. Please and save (as an html file) and view with NN or
Firefox (or maybe even Mozilla), and then view. When loaded:
(1.) Place the mouse over "Top Menu" item.
(The menu opens)
(2.) Move to any of the sub-menu items.
(3.) Click on the left or right (but NOT on the text) of the current
sub-item
(The menu collapses)
(4.) Now place the mose over the top-menu
-> The menu opens as expected, but the an annoying highlight
appears, and follows the mouse.
Please tell me there's a work-around.
------------------------ H T M L ------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script type="text/javascript">
function getIndex(){
if (navigator.appName == "Microsoft Internet Explorer"){
return 2;
}
else if (navigator.appName == "Netscape"){
return 3;
}
}
function bindListeners(){
var anchors = document.getElementsByTagName("A");
for (i = 0; i < anchors.length; i++){
anchors.onmousedown = function() {
this.className = "mouseDown";
}
anchors.onmouseup = function() {
this.className = "mouseUp";
var object = this.parentNode.parentNode.parentNode;
var object1 = object.parentNode.parentNode;
if (object.tagName.toUpperCase() == 'BODY'){
// top-menu
this.parentNode.childNodes[getIndex()].style.display = 'none';
}
else if( object1.tagName.toUpperCase() == 'BODY' ){
// sub-menu
this.parentNode.parentNode.style.display =
'none';
}
}
anchors.onmouseover = function(){
var object = this.parentNode.parentNode.parentNode;
var object1 = object.parentNode.parentNode;
if (object.tagName.toUpperCase() == 'BODY'){
// top-menu
this.parentNode.childNodes[getIndex()].style.display = 'block';
}
else if(
object.parentNode.parentNode.tagName.toUpperCase() == 'BODY' ){
// sub-menu
this.parentNode.parentNode.style.display =
'block';;
}
}
}
}
</script>
<style type="text/css">
li {
background-color: #FFFFFF;
font-weight: normal;
font-family: arial;
font-size: 12px;
text-align: center;
margin: 0;
padding: 0;
height: 1%;
}
ul{
margin: 0;
padding: 0;
list-style: none;
}
a {
display: block;
width: 120px;
text-decoration: none;
color: #000000;
padding: 2px 15px 2px 15px;
}
li:hover ul {
display: block;
}
li ul {
display: none;
}
body li{
width: 150px;
}
li.collapse {
display: none;
}
ul li ul li {
border-top: 1px solid black;
}
li.topMenu {
border: 1px solid black;
}
</style>
<title>test</title>
</head>
<body onLoad="bindListeners()">
<ul><li class="topMenu">
<a href="#">Top Menu</a>
<ul>
<li><a href="#">Sub-menu 1</a></li>
<li><a href="#">Sub-menu 2</a></li>
<li><a href="#">Sub-menu 3</a></li>
<li><a href="#">Sub-menu 4</a></li>
</ul>
</li></ul>
</body>
</html>
------------------------ H T M L ------------------------
I wonder if this is the same bug that this guy is talking about?
http://groups.google.co.uk/[email protected]&output=gplain
Thanks,
- Olumide
This one is better experienced than explained, so I'm including a code
sample below. Please and save (as an html file) and view with NN or
Firefox (or maybe even Mozilla), and then view. When loaded:
(1.) Place the mouse over "Top Menu" item.
(The menu opens)
(2.) Move to any of the sub-menu items.
(3.) Click on the left or right (but NOT on the text) of the current
sub-item
(The menu collapses)
(4.) Now place the mose over the top-menu
-> The menu opens as expected, but the an annoying highlight
appears, and follows the mouse.
Please tell me there's a work-around.
------------------------ H T M L ------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script type="text/javascript">
function getIndex(){
if (navigator.appName == "Microsoft Internet Explorer"){
return 2;
}
else if (navigator.appName == "Netscape"){
return 3;
}
}
function bindListeners(){
var anchors = document.getElementsByTagName("A");
for (i = 0; i < anchors.length; i++){
anchors.onmousedown = function() {
this.className = "mouseDown";
}
anchors.onmouseup = function() {
this.className = "mouseUp";
var object = this.parentNode.parentNode.parentNode;
var object1 = object.parentNode.parentNode;
if (object.tagName.toUpperCase() == 'BODY'){
// top-menu
this.parentNode.childNodes[getIndex()].style.display = 'none';
}
else if( object1.tagName.toUpperCase() == 'BODY' ){
// sub-menu
this.parentNode.parentNode.style.display =
'none';
}
}
anchors.onmouseover = function(){
var object = this.parentNode.parentNode.parentNode;
var object1 = object.parentNode.parentNode;
if (object.tagName.toUpperCase() == 'BODY'){
// top-menu
this.parentNode.childNodes[getIndex()].style.display = 'block';
}
else if(
object.parentNode.parentNode.tagName.toUpperCase() == 'BODY' ){
// sub-menu
this.parentNode.parentNode.style.display =
'block';;
}
}
}
}
</script>
<style type="text/css">
li {
background-color: #FFFFFF;
font-weight: normal;
font-family: arial;
font-size: 12px;
text-align: center;
margin: 0;
padding: 0;
height: 1%;
}
ul{
margin: 0;
padding: 0;
list-style: none;
}
a {
display: block;
width: 120px;
text-decoration: none;
color: #000000;
padding: 2px 15px 2px 15px;
}
li:hover ul {
display: block;
}
li ul {
display: none;
}
body li{
width: 150px;
}
li.collapse {
display: none;
}
ul li ul li {
border-top: 1px solid black;
}
li.topMenu {
border: 1px solid black;
}
</style>
<title>test</title>
</head>
<body onLoad="bindListeners()">
<ul><li class="topMenu">
<a href="#">Top Menu</a>
<ul>
<li><a href="#">Sub-menu 1</a></li>
<li><a href="#">Sub-menu 2</a></li>
<li><a href="#">Sub-menu 3</a></li>
<li><a href="#">Sub-menu 4</a></li>
</ul>
</li></ul>
</body>
</html>
------------------------ H T M L ------------------------
I wonder if this is the same bug that this guy is talking about?
http://groups.google.co.uk/[email protected]&output=gplain
Thanks,
- Olumide