ZoomCities IT Community Webmaster Forum

Full Version: Display / Hide
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
<script language='JavaScript'>function swap_content(span) {displayType=(document.getElementById(span).style. display=='none') ? 'block':'none';document.getElementById(span).style .display=displayType;}</script>

Something
<span id="0007" style="display: none">
something inside :/

</span>
I would do something like this to make it less obtrusive:
Code:
<script type="text/javascript"><!--
function flipform(element)
{
    theForm = document.getElementById(element);
    if (theForm.className != "sub")
    {
        theForm.className = "sub";
    }
    else
    {
        theForm.className = "suboff";
    }
}
//--></script>

Then you can just style the suboff and sub with normal css instead of using javascript which may not be enabled.
wawa-

Great script! It's pretty compact, and easy to modify. I just might use that one sometime (or a modification of it).

darkfate Wrote:I would do something like this to make it less obtrusive:

code...

Then you can just style the suboff and sub with normal css instead of using javascript which may not be enabled.

darkfate-

I'm not sure why your script has an advantage over wawa's. Unless I'm not understanding, it seems like both scripts use JavaScript. So if JavaScript were turned off, neither would work. Could you explain its advantages a bit more? It seems like wawa's would be easier to use since it requires no additional CSS.
Well, I figure that it's less code in javascript. Having that separation seems logical to me.
Reference URL's