От доста време си търся такъв скрипт, но нещо не мога да си намеря читав... И ползвам този код. Когато е само един div си работи перфектно, но когато са примерно 2, при рефреш 2-рия винаги се показва, а 1-вия се крие...
Та ако някой е попадал на такъв скрипт, нека го сподели...
Код:
<html>
<head>
<script>
function toggleLayer( whichLayer )
{
var elem, vis;
if( document.getElementById ) // this is the way the standards work
elem = document.getElementById( whichLayer );
else if( document.all ) // this is the way old msie versions work
elem = document.all[whichLayer];
else if( document.layers ) // this is the way nn4 works
elem = document.layers[whichLayer];
vis = elem.style;
// if the style.display value is blank we try to figure it out here
if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}
</script>
<style>
div#commentForm
{
margin: 0px 20px 0px 20px;
display: none;
}
</style>
</head>
<body>
<a onClick="javascript:toggleLayer('commentForm');" title="Show/Hide Div">Show/Hide Div</a><br/>
<div id="commentForm">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap
into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum
passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
</body>
</html>
Та ако някой е попадал на такъв скрипт, нека го сподели...