Forum Moderators: open
Here is the code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>...</title>
<link href="main.css" rel="stylesheet" type="text/css" /><script type="text/javascript">
function showSub(id)
{
var el = document.getElementById(id);
if ( el.style.display != "none" )
{
el.style.display = "none";
}
else
{
secondmenuservices.style.display = "none";
secondmenuread.style.display = "none";
secondmenuabout.style.display = "none";
secondmenucontact.style.display = "none";
el.style.display = "";
}
}
</script>
</head>
Then I have a table cell with <a> in it, which is using that script onclick
<div id="mainmenu">
<table cellpadding="0px" cellspacing="0px" border="0px" width="100%" height="100%">
<td width="100%">
<a href="#" onclick="showSub('secondmenuservices')" class="nava">Button</a>
</td>
</table>
</div>
When clicked, it should show the table with id="secondmenuservices" and style display:none, when clicked again - hide it. Here it is.
<table id="secondmenuabout" cellpadding="0px" cellspacing="0px" border="0px" width="100%" height="100%" style="display:none; padding-left:20px">
<td>
<a href="123/123t.html" class="navb">О компании</a>
<a href="#" class="navb">123</a>
</td>
</table>
Thanks.
secondmenuservices, secondmenuread, secondmenuabout, secondmenucontact are no references. You need a handles for every one like:
secondmenuread = document.getElementById('id_name');
Other way it can't work