Use this to call your function:
<a href="javascript:toggleDiv('service_twitter','service_facebook','service_netvi bes','service_rss')">Show/Hide all</a>
Now in the function below, all of the id's you passed through go into an object called arguments. Then you can just loop through each argument, setting it's display style to 'none'
Code:
function toggleDiv()
{
for (var x = 0; x < arguments.length; x++){
var elem = document.getElementById(arguments[x]);
if ( elem.style.display != 'none' )
{
elem.style.display = 'none';
}
else
{
elem.style.display = 'block';
}
}
}
Bookmarks