Hello, I have a very simple html page here:
http://www.nomorepasting.com/getpaste.php?pasteid=22407
And I have 4 layers on the page. The reason for this is it is the framework oif a much more complicated site, I have simplified it to ask my question. Basically, I want to be able to click on different links in layer 2 and have the image in layer1 change, however The way I have found to do this:
<script type="text/javascript"><!--
function sbox(boxName,xname) {
theBox = document.getElementById(boxName);
theBox.className = xname;
}
//-->
</script>
Results in the text nto going away, which I need, as well as a way to click and replace whatever image is there with the text. I found alternative javascript code, but could not apply it to my html page.
<script type="text/javascript">
function toggleImg(myid)
{
objtxt = document.getElementById(myid);
objimg = document.getElementById(myid+'_img');
if( objtxt.style.display == 'block' ) // Show image, hide text
{
objtxt.style.display = 'none';
objimg.style.display = 'block';
}
else // Hide image, show text
{
objimg.style.display = 'none';
objtxt.style.display = 'block';
}
}
</script>
What is the easiest way to do this without changing the design of my page? note: I do not want to use a framework, I want to understand how this is done and do it for myself.
My additional question is on if layers should replace tables: Is it always bad to use tables when css could be used instead? Is it easy to use layers to make row and column equivalents just to format text data, not the structure of a site?