Click to See Complete Forum and Search --> : Javascript Error :(


elesedee.
08-05-2003, 05:28 PM
I am trying to put together a javascript out of parts of other scripts and due to the lack of knowledge I'm getting an error. The purpose of this script is to have a navigation (LINK1, LINK2,LINK3) and then have a sub navigation (link4) which opens with LINK2. then, link4 opens more content. What i want to hapen is for that content to disapear when the main navigation is clicked again. It works, but for some reason theres an error. I'm stumped :(

Here's the script:


<html>
<head>
<title>blah</title>

<style type="text/css">
#sec1{display:none}
#sec2{display:none}
#sec3{display:none}
#info{border:1px solid #DADADA; width:520px; height:450px; padding:10px; background-color:#F2F2F2; display:none}
</style>

<script language="Javascript">
lastone='empty';
function showIt(lyr)
{
if (lastone!='empty') lastone.style.display='none';
lastone=document.getElementById(lyr);
lastone.style.display='inline';
}
</script>

</head>

<body>
<a href="#" onClick="document.getElementById('sec1').style.display='inline',
document.getElementById('sec2').style.display='none',
document.getElementById('sec3').style.display='none',
lastone.style.display='none';">LINK1</a> /

<a href="#" onClick="document.getElementById('sec2').style.display='inline',
document.getElementById('sec1').style.display='none',
document.getElementById('sec3').style.display='none',
lastone.style.display='none';">LINK2</a> /

<a href="#" onClick="document.getElementById('sec3').style.display='inline',
document.getElementById('sec1').style.display='none',
document.getElementById('sec2').style.display='none',
lastone.style.display='none';">LINK3</a> / <br>

<br><br>

<div id="sec1">SECTION1 SECTION1<br>SECTION1 SECTION1<br>SECTION1 SECTION1<br>SECTION1 SECTION1<br>SECTION1 SECTION1</div><br>
<div id="sec2"><a href="JavaScript:;" onClick="showIt('info')">link4</a></div><br>
<div id="sec3">SECTION3<br>SECTION3<br>SECTION3<br>SECTION3</div>
<DIV id="info">BLAH</DIV>
<br>
content content content
</body>
</html>

elesedee.
08-05-2003, 09:36 PM
Anyone? :(