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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

supporting additional hide/show div in script

Status
Not open for further replies.

superfly404

Technical User
Feb 1, 2005
24
US
I have a script where I need to have multiple functional hide/show divs that work in the copy

Here's the code I'm using:
<style type="text/css">
div.code
{
background-color: #DDDDDD;
margin: 0px 50px 0px 50px;
}
div.quote
{
margin: 0px 50px 0px 50px;
background-color: #FDFFCA;
}
div.quote p
{
font-style: italic;
margin: 0px 0px 0px 0px;
}
div#commentForm
{
display: none;
margin: 0px 20px 0px 20px;
font-family: Arial, sans-serif;
font-size: .8em;
}
a.commentLink
{
font-family: Arial, sans-serif;
font-size: .8em;
}
img
{
border: 0px;
}
form
{
margin: 0px;
}
</style>
<script type="text/javascript">
function toggleLayer(whichLayer)
{
if (document.getElementById)
{
// this is the way the standards work
var style2 = document.getElementById(whichLayer).style;
style2.display = style2.display? "":"block";
}
else if (document.all)
{
// this is the way old msie versions work
var style2 = document.all[whichLayer].style;
style2.display = style2.display? "":"block";
}
else if (document.layers)
{
// this is the way nn4 works
var style2 = document.layers[whichLayer].style;
style2.display = style2.display? "":"block";
}
}
</script>

<a href="javascript:toggleLayer('1');" title="Add a comment to this entry">Copy 1</a>
<div id="1">
Copy 1 goes here</div>

---------------------------------

I tried adding additional code, as such, but didnt work?

<a href="javascript:toggleLayer('2');" title="Add a comment to this entry">Copy 1</a>
<div id="2">
Copy 2 goes here</div>



Any ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top