rendered paste body<html>
<head>
<title>test</title>
<style type="text/css">
#two, #three
{
height : 100px;
width :100px;
display : none;
background: red;
}
#one div
{
height: 100px;
width: 100px;
display: block;
background: blue;
}
</style>
<script type="text/javascript">
this.onload = function()
{
alert("meh");
forEachItem(document.getElementsByTagName("a"), function (link)
{
if( link.getAttribute("rel") == "tab")
{
link.onclick = function ()
{
switch(link.nodeName)
{
case "one":
link.parentNode.getElementById('one').style.display="block";
link.parentNode.getElementById('two').style.display="none";
link.parentNode.getElementById('three').style.display="none";
break;
case "#two":
link.parentNode.getElementById('one').style.display="none";
link.parentNode.getElementById('two').style.display="block";
link.parentNode.getElementById('three').style.display="none";
break;
case "three":
link.parentNode.getElementById('one').style.display="none";
link.parentNode.getElementById('two').style.display="none";
link.parentNode.getElementById('three').style.display="block";
break;
}
};
}
});
}
</script>
</head>
<body>
<div>
<a rel="tab" href="#one">one</a><br />
<a rel="tab" href="#two">two</a><br />
<a rel="tab" href="#three">three</a><br />
</div>
<div id="one">yay. div one!</div><br />
<div id="two">yay. div two!</div><br />
<div id="three">yay. div three!</div><br />
</body>
</html>