Сообщение от Just In Live
|
мне что нужно ьдописать это?
|
<script>
window.onload = function() {
var links = document.getElementById('menu').getElementsByTagName('a'),
i = links.length;
while(i--) {
links[i].onclick = function() {
var str = this.hash.replace(/#/, ''),
dd = document.getElementById(str),
childrens = dd.parentNode.children,
i = childrens.length;
while(i--) {
var node = childrens[i];
if(node.nodeName == 'DD' && node.id != str) {
node.style.display = '';
}
}
dd.style.display = (dd.style.display == '') ? 'block' : '';
return false;
};
}
};
</script>
<dl id="menu">
<dt><a href="#link1">click1</a></dt>
<dd id="link1">text1</dd>
<dt><a href="#link2">click2</a></dt>
<dd id="link2">text2</dd>
<dt><a href="#link3">click3</a></dt>
<dd id="link3">text3</dd>
</dl>
<style>
dd {display: none;}
</style>