help for javascript,cs and html

B

brian

problems :
Menu is always flash when the mouse move over.and when expand one
menu,other menus positons is moved.I don't want to move the menus
positons when expanding some menu.

Thanks

my codes includes 3 files as the following:

<<a.html>>

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/
TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1" />
<meta name="GENERATOR" content="IBM Software Development Platform" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="stylesheet" type="text/css" href="leftmenu2.css" />
<script type="text/javascript" src="leftmenu2.js"></script>
<title>MetaData</title>
</head>
<body>
<table width="100" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td width="20">
<div class="menu1" onmouseover="showHide('submenu1')">menu1</div>
</td>
<td width="20">
<div class="menu1" onmouseover="showHide('submenu2')">menu2</div>
</td>
<td width="20">
<div class="menu1" onmouseover="showHide('submenu3')">menu3</div>
</td>
<td width="20">
<div class="menu1" onmouseover="showHide('submenu4')">menu4</div>
</td>
</tr>



<tr>
<td width="20">
<div id="submenu1" class="hide">
<a href="#" class="submenu">submenu1</a>
<a href="#" class="submenu">submenu2222</a>
<a href="#" class="submenu">submenu33333</a>
</div>
</td>
<td width="20">
<div id="submenu2" class="hide">
<a href="#" class="submenu">submenu1</a>
<a href="#" class="submenu">submenu2222</a>
<a href="#" class="submenu">submenu33333</a>

</div>
</td>
<td width="20">
<div id="submenu3" class="hide">
<a href="#" class="submenu">submenu1</a>
<a href="#" class="submenu">submenu2222</a>
<a href="#" class="submenu">submenu33333</a>
</div>
</td>
<td width="20">
<div id="submenu4" class="hide">
<a href="#" class="submenu">submenu1</a>
<a href="#" class="submenu">submenu2222</a>
<a href="#" class="submenu">submenu33333</a>

</div>
</td>
</tr>

</table>

</body>
</html>



<<leftmenu2.js>>

var last_expanded = '';

function showHide(id)
{
var obj = document.getElementById(id);

var status = obj.className;

if (status == 'hide') {

if (last_expanded != '') {
var last_obj = document.getElementById(last_expanded);
last_obj.className = 'hide';
}

obj.className = 'show';

last_expanded = id;
} else {
obj.className = 'hide';
}
}


}


<<leftmenu2.css>>

..submenu{
/*background-image: url(../images/white.jpg);*/
display: block;
height: 19px;
width:100px;
margin-left: 38px;
padding-top: 2px;
padding-left: 7px;
color: #333333;
}
..submenu:hover{
background-color: #5A8EC6;
}

..leftmenu{
/*background-image: url(../images/white.jpg);*/
display: block;
height: 19px;
margin-left: 38px;
width:100px;
padding-top: 2px;
padding-left: 7px;
color: #333333;
}
..leftmenu:hover{
/*background-image: url(../images/white.jpg);*/
background-color: #FFFFFF;
}
..hide{
display: none;
}
..show{
display: block;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top