S
shelliebayne
I'm a complete JavaScript Moron. Just thought I'd clear that up to
start
I have a menu going across the top of my webpage. When I click one of
those options, I want another javascript menu to appear on the left
side of the page. The left menu needs to change depending on what is
selected at the top. I know this has to be common but I just can't
find something to help me.
Any local JS genius able to help or point me in the right direction?
I've pasted some what I've been working with, but I'll willingly scrap
it...I just need to to work.
<script type="text/javascript">
<!--
function SwitchMenu(obj)
{
if(document.getElementById)
{
var el = document.getElementById(obj);
var ar =
document.getElementById("cont").getElementsByTagName("DIV");
if(el.style.display == "none")
{
for (var i=0; i<ar.length; i++)
{
ar.style.display = "none";
}
el.style.display = "block";
}
else
{
el.style.display = "none";
}
}
}
function ChangeClass(menu, newClass)
{
if (document.getElementById)
{
document.getElementById(menu).className = newClass;
}
}
document.onselectstart = new Function("return false");
// -->
</script>
This next bit is for the horizontal bar across the top...
By the way, only the first two of the six menus have been coded.
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="blank.gif" alt="" width="20" height="1"></td>
<td><a target="_top"
onclick="MM_nbGroup('down','group1','logo','',1)"
onmouseover="MM_nbGroup('over','logo','','',1)"
onmouseout="MM_nbGroup('out')"><img src="/img/logo.gif" alt=""
name="logo" width="170" height="107" border="0"></a></td>
<div id="cont">
<td>
<p id="menu1"
class="menuOut"
onclick="SwitchMenu('sub1')"
onmouseover="ChangeClass('menu1','menuOver')"
onmouseout="ChangeClass('menu1','menuOut')"> <a
target="_top"
onclick="MM_nbGroup('down','group1','1','/img/01_03.gif',1)"
onmouseover="MM_nbGroup('over','1','/img/01_02.gif','/img/01_03.gif',1)"
onmouseout="MM_nbGroup('out')"><img src="/img/01_01.gif" alt=""
name="1" width="93" height="58" border="0"></a></p></td>
<td>
<p id="menu2"
class="menuOut"
onclick="SwitchMenu('sub2')"
onmouseover="ChangeClass('menu2','menuOver')"
onmouseout="ChangeClass('menu2','menuOut')"> <a
target="_top"
onclick="MM_nbGroup('down','group1','2','/img/02_03.gif',1)"
onmouseover="MM_nbGroup('over','2','/img/02_02.gif','/img/02_03.gif',1)"
onmouseout="MM_nbGroup('out')"><img src="/img/02_01.gif" alt=""
name="2" width="93" height="58" border="0"></a></p></td>
<td><a target="_top"
onclick="MM_nbGroup('down','group1','3','/img/03_03.gif',1)"
onmouseover="MM_nbGroup('over','3','/img/03_02.gif','/img/03_03.gif',1)"
onmouseout="MM_nbGroup('out')"><img src="/img/03_01.gif" alt=""
name="3" width="93" height="58" border="0"></a></td>
<td><a target="_top"
onclick="MM_nbGroup('down','group1','4','/img/04_03.gif',1)"
onmouseover="MM_nbGroup('over','4','/img/04_02.gif','/img/04_03.gif',1)"
onmouseout="MM_nbGroup('out')"><img src="/img/04_01.gif" alt=""
name="4" width="93" height="58" border="0"></a></td>
<td><a target="_top"
onclick="MM_nbGroup('down','group1','5','/img/05_03.gif',1)"
onmouseover="MM_nbGroup('over','5','/img/05_02.gif','/img/05_03.gif',1)"
onmouseout="MM_nbGroup('out')"><img src="/img/05_01.gif" alt=""
name="5" width="93" height="58" border="0"></a></td>
<td><a target="_top"
onclick="MM_nbGroup('down','group1','6','/img/06_03.gif',1)"
onmouseover="MM_nbGroup('over','6','/img/06_02.gif','/img/06_03.gif',1)"
onmouseout="MM_nbGroup('out')"><img src="/img/06_01.gif" alt=""
name="6" width="95" height="58" border="0"></a></td>
</div>
</tr>
</table>
finally, this is the code in the sidebar...
<div class="submenu" id="sub1" style="display:none;" >
<a href="http://www.rustywheels.net">blog</a><br />
<a href="http://www.rustywheels.net/page2.php">rw.n page
2</a> <br />
</div>
<div class="submenu" id="sub2" style="display:none;" >
<a href="http://www.rustywheels.net">blog</a><br />
<a href="http://www.rustywheels.net/page2.php">rw.n page
2</a> <br />
</div>
This works except I have to click the horizonal menu option a second
time to make the sidebar menu disappear instead of it doing it
automaticly when I click another option across the top.
Please, please advise.
Tom
start
I have a menu going across the top of my webpage. When I click one of
those options, I want another javascript menu to appear on the left
side of the page. The left menu needs to change depending on what is
selected at the top. I know this has to be common but I just can't
find something to help me.
Any local JS genius able to help or point me in the right direction?
I've pasted some what I've been working with, but I'll willingly scrap
it...I just need to to work.
<script type="text/javascript">
<!--
function SwitchMenu(obj)
{
if(document.getElementById)
{
var el = document.getElementById(obj);
var ar =
document.getElementById("cont").getElementsByTagName("DIV");
if(el.style.display == "none")
{
for (var i=0; i<ar.length; i++)
{
ar.style.display = "none";
}
el.style.display = "block";
}
else
{
el.style.display = "none";
}
}
}
function ChangeClass(menu, newClass)
{
if (document.getElementById)
{
document.getElementById(menu).className = newClass;
}
}
document.onselectstart = new Function("return false");
// -->
</script>
This next bit is for the horizontal bar across the top...
By the way, only the first two of the six menus have been coded.
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="blank.gif" alt="" width="20" height="1"></td>
<td><a target="_top"
onclick="MM_nbGroup('down','group1','logo','',1)"
onmouseover="MM_nbGroup('over','logo','','',1)"
onmouseout="MM_nbGroup('out')"><img src="/img/logo.gif" alt=""
name="logo" width="170" height="107" border="0"></a></td>
<div id="cont">
<td>
<p id="menu1"
class="menuOut"
onclick="SwitchMenu('sub1')"
onmouseover="ChangeClass('menu1','menuOver')"
onmouseout="ChangeClass('menu1','menuOut')"> <a
target="_top"
onclick="MM_nbGroup('down','group1','1','/img/01_03.gif',1)"
onmouseover="MM_nbGroup('over','1','/img/01_02.gif','/img/01_03.gif',1)"
onmouseout="MM_nbGroup('out')"><img src="/img/01_01.gif" alt=""
name="1" width="93" height="58" border="0"></a></p></td>
<td>
<p id="menu2"
class="menuOut"
onclick="SwitchMenu('sub2')"
onmouseover="ChangeClass('menu2','menuOver')"
onmouseout="ChangeClass('menu2','menuOut')"> <a
target="_top"
onclick="MM_nbGroup('down','group1','2','/img/02_03.gif',1)"
onmouseover="MM_nbGroup('over','2','/img/02_02.gif','/img/02_03.gif',1)"
onmouseout="MM_nbGroup('out')"><img src="/img/02_01.gif" alt=""
name="2" width="93" height="58" border="0"></a></p></td>
<td><a target="_top"
onclick="MM_nbGroup('down','group1','3','/img/03_03.gif',1)"
onmouseover="MM_nbGroup('over','3','/img/03_02.gif','/img/03_03.gif',1)"
onmouseout="MM_nbGroup('out')"><img src="/img/03_01.gif" alt=""
name="3" width="93" height="58" border="0"></a></td>
<td><a target="_top"
onclick="MM_nbGroup('down','group1','4','/img/04_03.gif',1)"
onmouseover="MM_nbGroup('over','4','/img/04_02.gif','/img/04_03.gif',1)"
onmouseout="MM_nbGroup('out')"><img src="/img/04_01.gif" alt=""
name="4" width="93" height="58" border="0"></a></td>
<td><a target="_top"
onclick="MM_nbGroup('down','group1','5','/img/05_03.gif',1)"
onmouseover="MM_nbGroup('over','5','/img/05_02.gif','/img/05_03.gif',1)"
onmouseout="MM_nbGroup('out')"><img src="/img/05_01.gif" alt=""
name="5" width="93" height="58" border="0"></a></td>
<td><a target="_top"
onclick="MM_nbGroup('down','group1','6','/img/06_03.gif',1)"
onmouseover="MM_nbGroup('over','6','/img/06_02.gif','/img/06_03.gif',1)"
onmouseout="MM_nbGroup('out')"><img src="/img/06_01.gif" alt=""
name="6" width="95" height="58" border="0"></a></td>
</div>
</tr>
</table>
finally, this is the code in the sidebar...
<div class="submenu" id="sub1" style="display:none;" >
<a href="http://www.rustywheels.net">blog</a><br />
<a href="http://www.rustywheels.net/page2.php">rw.n page
2</a> <br />
</div>
<div class="submenu" id="sub2" style="display:none;" >
<a href="http://www.rustywheels.net">blog</a><br />
<a href="http://www.rustywheels.net/page2.php">rw.n page
2</a> <br />
</div>
This works except I have to click the horizonal menu option a second
time to make the sidebar menu disappear instead of it doing it
automaticly when I click another option across the top.
Please, please advise.
Tom