Hola!
Perhaps I have missunderstand you and this might not be what you are loking for at all,
JS-file
var one = 0;
var two = 0;
function myClickOne()
{
if(one == 0)
{
one = 1;
window.document.all.part1_sub.className = \'on\';
}
else
{
one = 0;
window.document.all.part1_sub.className = \'off\';
}
}
function myClickTwo()
{
if(one == 0)
{
one = 1;
window.document.all.part2_sub.className = \'on\';
}
else
{
one = 0;
window.document.all.part2_sub.className = \'off\';
}
}
window.document.all.part1.onclick = myClickOne;
window.document.all.part2.onclick = myClickTwo;
CSS-fil
.header
{
font-weight: italic;
cursor: e-resize;
}
.on
{
}
.off
{
display: none;
}
.invis
{
color: white;
}
HTML-file:
<head>
<title>3b</title>
<link href=\"css/lektion3b.css\" rel=\"stylesheet\" type=\"text/css\"/>
</head>
<body>
<h1>DHTML/innehåll: användarstyrd textförändring 2</h1>
<div id=\"part1\" class=\"header\">DEL I</div>
<div id=\"part1_sub\" class=\"off\">
<span class=\"invis\">---</span><span><a href=\'
http://www.nu\'>Kap 1</a><br/></span>
</div>
<div id=\"part2\" class=\"header\">DEL II</div>
<div id=\"part2_sub\" class=\"off\">
<span class=\"invis\">---</span><span><a href=\'
http://www.nu\'>Kap 2</a><br/></span>
<span class=\"invis\">---</span><span><a href=\'
http://www.nu\'>Kap 3</a><br/></span>
<span class=\"invis\">---</span><span><a href=\'
http://www.nu\'>Kap 4</a><br/></span>
</div>
<script type=\"text/JScript.Encode\" src=\"js/lektion3b.js\"></script>
<p>
<a href=\"
http://validator.w3.org/check/referer\">Valid XHTML 1.0</a>
<a href=\"
http://jigsaw.w3.org/css-validator/\">Valid CSS</a>
</p>
</body>
Best regards
Fredrik