// How To Use this Library (SWH) // create some <div id="weapon2" class="weapon" style="display:none"> some stuff </div> // then in the link/button/image call this: showBlock('weapon2') to show the second for example. // you can make the defaut div not hidden.
function showBlock(theId) {
// first hide all the divs
hideAll('hideMe');
// then find and show the required one
if (document.layers)
{
document.layers[theId].display = 'block';
}
else if (document.all)
{
document.all[theId].style.display = 'block';
}
else if (document.getElementById)
{
document.getElementById(theId).style.display = 'block';
}
}
// SWH: TODO: check if this is browser safe. function hideAll(label) {
// find all the Divs
var x = document.getElementsByTagName('div');
for (var i=0;i<x.length;i++)
{
// and if they are the required ones....
if (x[i].className == label) {
// hide it
x[i].style.display='none';
}
}
}