KILLERTech
03-12-2004, 08:23 PM
Hello!
I'm new here, and I'm new with JavaScript.
I found one great script for makeing menus, but I don't know how to make a little change in it.
I want, when I click on one SubMenu, Mp3s for example, and after than I click on other, Video Clips for example, the opened Mp3s Sub menu, to be closed (when I click on any other, not just on Video Clips).
I suppose it's simple, but for now I don't have any idea how to make it.
Please Help me.
Here is the whole page:
-------------------------------
<html>
<head>
<meta http-equiv="Content-Language" content="bg">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<META NAME="web design" CONTENT="KILLER Tech">
<title> Menu</title>
<style type="text/css">
body {font-family: Arial; font-size: 8pt;}
a {text-decoration: none; color: #FFFFFF;}
a:hover {text-decoration: none; color: #00FF00}
.child {font-family: Arial; color: #000000; text-decoration:none; display:none}
.parent {font-family: Arial; color: #000000; text-decoration:none;}
.item {color: white; text-decoration: none; font-size: 8pt;}
.biginfo {font-family: Arial; color: #FFFFFF; font-size: 8pt; font-weight: bold;}
.info {font-family: Arial; color: #FFFFFF; font-size: 7pt; font-weight: bold;}
.stats {font-family: Arial; font-size:10px; color: white;}
.statshead {font-family: Arial; font-size:10px; color: white; font-weight: bold;}
.menu {font: 12px/13px; Times; color: #FFFFFF;}
.submenu {font: 12px/13px; Times; color: #FFFFFF;}
.menutitle {font: 12pt; font-family: Arial; font-weight: bold; color: #FFFFFF;}
BODY {scrollbar-darkshadow-color: #A9A9A9; scrollbar-track-color: #FFFFFF;
scrollbar-face-color: #000000; scrollbar-arrow-color: #CDCDCD;
scrollbar-highlight-color: black; scrollbar-3dlight-color: #FFFFFF;
font-family: Arial; font-size:5pt; }
</style>
<script language="JavaScript">
<!--
function SymError()
{
return true;
}
window.onerror = SymError;
//-->
</script>
<script LANGUAGE="JavaScript">
function expandIt(){return}
</script>
<script LANGUAGE="JavaScript1.2">
function initIt(){
for(i=0; i<document.getElementsByTagName("DIV").length; i++) {
if(document.getElementsByTagName("DIV")[i].className == "child") {
document.getElementsByTagName("DIV")[i].style.display = 'none';}
}
}
function expandIt(el) {
whichIm = el+"Img"; whichEl = el+"Child"; i=el;
if (document.getElementById(whichEl).style.display == "none") {
document.getElementById(whichEl).style.display="block";
document.getElementById(whichIm).src="minus.bmp";
}
else {
document.getElementById(whichEl).style.display="none";
document.getElementById(whichIm).src="dot.bmp";
}
}
var correctwidth=1024; var correctheight=768;
document.write("<STYLE TYPE='text/css'>");
if (screen.width<correctwidth||screen.height<correctheight) document.write("TR {FONT-SIZE: 10px; FONT-FAMILY: Verdana;}");
else document.write("TR {FONT-SIZE: 13px; FONT-FAMILY: Verdana;}");
document.write("</STYLE>");
</script>
</head>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="10" bgcolor=#DCDCDC>
<br><br>
<table border=5 cellpadding=0 cellspacing=0 align='center' bgcolor='#ffffff'><tr><td>
<table cellpadding=1 cellspacing=1 border=5 width=160 ><tr><td align='left' bgcolor='#000000'> <center>
<table border=0><tr><td></td></tr></table>
<div align="center">
<table cellpadding=2 cellspacing=0 border=1 width=140 bgcolor="#808080"><tr><td align="center">
<a class="menutitle" HREF="http://www.killertech.data.bg/main.html" target="contents">
<font class="menutitle">KILLER Tech</font></a>
</td></tr></table></div>
</center>
<table border=0><tr><td></td></tr></table>
<table border=0 cellspacing=0 cellpadding=0 align='left'><tr><td align='left'>
<div ID="el0Parent">
<a class="submenu" target="contents">
<img NAME="imEx" SRC="line.bmp" BORDER="0" ALT="KILLER Tech" ID="el0Img">
</a>
</div>
<div ID="el1Parent">
<a class="menu" HREF="#" onClick="expandIt('el1'); return false;">
<img NAME="imEx" SRC="dot.bmp" BORDER="0" ALT="Mp3s" ID="el1Img">
Mp3s</a>
</div>
<div ID="el1Child" CLASS="child">
<div align="center">
<script language="JavaScript1.2">
document.write('<a class="item" HREF="/Mp3s/" target="contents"> All</a><br>');
document.write('<a class="item" target="contents"> </a><br>');
document.write('<a class="item" target="contents"> <FONT COLOR="#FFD700">-<:=Albums=:>-</FONT></a><br>');
document.write('<a class="item" target="contents"> </a><br>');
</script>
</div>
</div>
<div ID="el2Parent">
<a class="submenu" target="contents">
<img NAME="imEx" SRC="line.bmp" BORDER="0" ALT="KILLER Tech" ID="el2Img">
</a>
</div>
<div ID="el3Parent">
<a class="menu" HREF="#" onClick="expandIt('el3'); return false;">
<img NAME="imEx" SRC="dot.bmp" BORDER="0" ALT="Video Clips" ID="el3Img">
Video Clips</a>
</div>
<div ID="el3Child" CLASS="child">
<div align="center">
<script language="JavaScript1.2">
document.write('<a class="item" HREF="/Video%20Clips/" target="contents"> All</a><br>');
document.write('<a class="item" target="contents"> </a><br>');
document.write('<a class="item" target="contents"> <FONT COLOR="#FFD700">-<:=Artists=:>-</FONT></a><br>');
document.write('<a class="item" target="contents"> </a><br>');
</script>
</div>
</div>
<div ID="el4Parent">
<a class="submenu" target="contents">
<img NAME="imEx" SRC="line.bmp" BORDER="0" ALT="KILLER Tech" ID="el4Img">
</a>
</div>
<div ID="el5Parent">
<a class="menu" HREF="#" onClick="expandIt('el5'); return false;">
<img NAME="imEx" SRC="dot.bmp" BORDER="0" ALT="+" ID="el5Img">
Wallpapers</a>
</div>
<div ID="el5Child" CLASS="child">
<div align="center">
<script language="JavaScript1.2">
document.write('<a class="item" HREF="" target="contents"> </a><br>');
document.write('<a class="item" HREF="/Wallpapers/3D%20Art" target="contents"> 3D Art</a><br>');
document.write('<a class="item" HREF="/Wallpapers/Bad%20Boys%202/" target="contents"> Bad Boys 2</a><br>');
document.write('<a class="item" HREF="/Wallpapers/" target="contents"> </a><br>');
</script>
</div>
</div>
</div>
<div ID="el6Parent">
<a class="submenu" target="contents">
<img NAME="imEx" SRC="line.bmp" BORDER="0" ALT="KILLER Tech" ID="el6Img">
</a>
</div>
<br>
</td>
</tr>
<td>
<div align="center">
<table border=5><tr><td>
<div ID="el1007Parent">
<div align="center">
<img NAME="imEx" SRC="killer.jpg" BORDER="0" ALT="KILLER Tech" ID="el10071Img">
</div>
</div>
<center>
<table border=3 bordercolorlight="#00FF00" bordercolordark="#32CD32"><tr><td>
<A HREF="mailto:killer_tech@abv.bg">killer_tech@abv.bg</A>
</td></tr></table>
</center>
</td></tr></table>
</div>
</td>
</table>
<script language="JavaScript1.2">
onload = initIt;
</script>
</center>
</body>
</html>
I'm new here, and I'm new with JavaScript.
I found one great script for makeing menus, but I don't know how to make a little change in it.
I want, when I click on one SubMenu, Mp3s for example, and after than I click on other, Video Clips for example, the opened Mp3s Sub menu, to be closed (when I click on any other, not just on Video Clips).
I suppose it's simple, but for now I don't have any idea how to make it.
Please Help me.
Here is the whole page:
-------------------------------
<html>
<head>
<meta http-equiv="Content-Language" content="bg">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<META NAME="web design" CONTENT="KILLER Tech">
<title> Menu</title>
<style type="text/css">
body {font-family: Arial; font-size: 8pt;}
a {text-decoration: none; color: #FFFFFF;}
a:hover {text-decoration: none; color: #00FF00}
.child {font-family: Arial; color: #000000; text-decoration:none; display:none}
.parent {font-family: Arial; color: #000000; text-decoration:none;}
.item {color: white; text-decoration: none; font-size: 8pt;}
.biginfo {font-family: Arial; color: #FFFFFF; font-size: 8pt; font-weight: bold;}
.info {font-family: Arial; color: #FFFFFF; font-size: 7pt; font-weight: bold;}
.stats {font-family: Arial; font-size:10px; color: white;}
.statshead {font-family: Arial; font-size:10px; color: white; font-weight: bold;}
.menu {font: 12px/13px; Times; color: #FFFFFF;}
.submenu {font: 12px/13px; Times; color: #FFFFFF;}
.menutitle {font: 12pt; font-family: Arial; font-weight: bold; color: #FFFFFF;}
BODY {scrollbar-darkshadow-color: #A9A9A9; scrollbar-track-color: #FFFFFF;
scrollbar-face-color: #000000; scrollbar-arrow-color: #CDCDCD;
scrollbar-highlight-color: black; scrollbar-3dlight-color: #FFFFFF;
font-family: Arial; font-size:5pt; }
</style>
<script language="JavaScript">
<!--
function SymError()
{
return true;
}
window.onerror = SymError;
//-->
</script>
<script LANGUAGE="JavaScript">
function expandIt(){return}
</script>
<script LANGUAGE="JavaScript1.2">
function initIt(){
for(i=0; i<document.getElementsByTagName("DIV").length; i++) {
if(document.getElementsByTagName("DIV")[i].className == "child") {
document.getElementsByTagName("DIV")[i].style.display = 'none';}
}
}
function expandIt(el) {
whichIm = el+"Img"; whichEl = el+"Child"; i=el;
if (document.getElementById(whichEl).style.display == "none") {
document.getElementById(whichEl).style.display="block";
document.getElementById(whichIm).src="minus.bmp";
}
else {
document.getElementById(whichEl).style.display="none";
document.getElementById(whichIm).src="dot.bmp";
}
}
var correctwidth=1024; var correctheight=768;
document.write("<STYLE TYPE='text/css'>");
if (screen.width<correctwidth||screen.height<correctheight) document.write("TR {FONT-SIZE: 10px; FONT-FAMILY: Verdana;}");
else document.write("TR {FONT-SIZE: 13px; FONT-FAMILY: Verdana;}");
document.write("</STYLE>");
</script>
</head>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="10" bgcolor=#DCDCDC>
<br><br>
<table border=5 cellpadding=0 cellspacing=0 align='center' bgcolor='#ffffff'><tr><td>
<table cellpadding=1 cellspacing=1 border=5 width=160 ><tr><td align='left' bgcolor='#000000'> <center>
<table border=0><tr><td></td></tr></table>
<div align="center">
<table cellpadding=2 cellspacing=0 border=1 width=140 bgcolor="#808080"><tr><td align="center">
<a class="menutitle" HREF="http://www.killertech.data.bg/main.html" target="contents">
<font class="menutitle">KILLER Tech</font></a>
</td></tr></table></div>
</center>
<table border=0><tr><td></td></tr></table>
<table border=0 cellspacing=0 cellpadding=0 align='left'><tr><td align='left'>
<div ID="el0Parent">
<a class="submenu" target="contents">
<img NAME="imEx" SRC="line.bmp" BORDER="0" ALT="KILLER Tech" ID="el0Img">
</a>
</div>
<div ID="el1Parent">
<a class="menu" HREF="#" onClick="expandIt('el1'); return false;">
<img NAME="imEx" SRC="dot.bmp" BORDER="0" ALT="Mp3s" ID="el1Img">
Mp3s</a>
</div>
<div ID="el1Child" CLASS="child">
<div align="center">
<script language="JavaScript1.2">
document.write('<a class="item" HREF="/Mp3s/" target="contents"> All</a><br>');
document.write('<a class="item" target="contents"> </a><br>');
document.write('<a class="item" target="contents"> <FONT COLOR="#FFD700">-<:=Albums=:>-</FONT></a><br>');
document.write('<a class="item" target="contents"> </a><br>');
</script>
</div>
</div>
<div ID="el2Parent">
<a class="submenu" target="contents">
<img NAME="imEx" SRC="line.bmp" BORDER="0" ALT="KILLER Tech" ID="el2Img">
</a>
</div>
<div ID="el3Parent">
<a class="menu" HREF="#" onClick="expandIt('el3'); return false;">
<img NAME="imEx" SRC="dot.bmp" BORDER="0" ALT="Video Clips" ID="el3Img">
Video Clips</a>
</div>
<div ID="el3Child" CLASS="child">
<div align="center">
<script language="JavaScript1.2">
document.write('<a class="item" HREF="/Video%20Clips/" target="contents"> All</a><br>');
document.write('<a class="item" target="contents"> </a><br>');
document.write('<a class="item" target="contents"> <FONT COLOR="#FFD700">-<:=Artists=:>-</FONT></a><br>');
document.write('<a class="item" target="contents"> </a><br>');
</script>
</div>
</div>
<div ID="el4Parent">
<a class="submenu" target="contents">
<img NAME="imEx" SRC="line.bmp" BORDER="0" ALT="KILLER Tech" ID="el4Img">
</a>
</div>
<div ID="el5Parent">
<a class="menu" HREF="#" onClick="expandIt('el5'); return false;">
<img NAME="imEx" SRC="dot.bmp" BORDER="0" ALT="+" ID="el5Img">
Wallpapers</a>
</div>
<div ID="el5Child" CLASS="child">
<div align="center">
<script language="JavaScript1.2">
document.write('<a class="item" HREF="" target="contents"> </a><br>');
document.write('<a class="item" HREF="/Wallpapers/3D%20Art" target="contents"> 3D Art</a><br>');
document.write('<a class="item" HREF="/Wallpapers/Bad%20Boys%202/" target="contents"> Bad Boys 2</a><br>');
document.write('<a class="item" HREF="/Wallpapers/" target="contents"> </a><br>');
</script>
</div>
</div>
</div>
<div ID="el6Parent">
<a class="submenu" target="contents">
<img NAME="imEx" SRC="line.bmp" BORDER="0" ALT="KILLER Tech" ID="el6Img">
</a>
</div>
<br>
</td>
</tr>
<td>
<div align="center">
<table border=5><tr><td>
<div ID="el1007Parent">
<div align="center">
<img NAME="imEx" SRC="killer.jpg" BORDER="0" ALT="KILLER Tech" ID="el10071Img">
</div>
</div>
<center>
<table border=3 bordercolorlight="#00FF00" bordercolordark="#32CD32"><tr><td>
<A HREF="mailto:killer_tech@abv.bg">killer_tech@abv.bg</A>
</td></tr></table>
</center>
</td></tr></table>
</div>
</td>
</table>
<script language="JavaScript1.2">
onload = initIt;
</script>
</center>
</body>
</html>