<ul>
<li onclick="showHide('first');return false;">First</li>
<li onclick="showHide('second');return false;">Second</li>
<li onclick="showHide('third');return false;">Third</li>
</ul>
<div id="container">
<div style="display: none;" id="first">First</div>
<div style="display: none;" id="second">Second</div>
<div style="display: none;" id="third">Third</div>
</div>
<script>
var container = document.getElementById('container');
function showHide(id) {
var divs = container .getElementsByTagName('div');
for(i = 0;i < divs.length;i++)
divs[i].style.display = 'none';
document.getElementById(id).style.display = 'run-in';
}
</script>
|