Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help in modifying a script

Status
Not open for further replies.

kylebellamy

Programmer
Jan 24, 2002
398
US
I need to modify this script so that it will hide other div layers when I click on a linked thumbnail. But it can't hide all the layers as there are other elements that need to remain. Basically it's a background changing script.

<script language="JavaScript1.2" type="text/javascript">

/*
Toggle Layer Visibility
© Eddie Traversa (nirvana.media3.net)
To add more shock to your site, visit Shock.com
*/

function toggleVisibility(id, NNtype, IEtype, WC3type) {
if (document.getElementById) {
eval("document.getElementById(id).style.visibility = \"" + WC3type + "\"");
} else {
if (document.layers) {
document.layers[id].visibility = NNtype;
} else {
if (document.all) {
eval("document.all." + id + ".style.visibility = \"" + IEtype + "\"");
}
}
}
}
</script>

And of course the link:
<a href="#" onClick="toggleVisibility('Layer4','show','visible','visible')">

I've looked high and low and cannot solve it. There are scripts that hide all but that doesn't help me as the nav and content for the site are also on div layers. Any ideas?

 
You should skip the NN 4.x and IE 4.0 and previous, as well as eval

Code:
function toggleVisibility(id, WC3type)
{
document.getElementById(id).style.visibility = WC3type;
}

If you want to not display the block, you can use block and none for W3Ctype with

Code:
function toggleVisibility(id, WC3type)
{
document.getElementById(id).style.display = W3Ctype;
}


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top