yes it can, but that function is ideal for when you have seperate links, like 'yes / no', 'show / hide', etc, where you can change the int -> yes would be 1, no would be 0.
if you want the function to show or hide with the same link - IE you have a name and on click you want to show or hide its details, you'd use something like this:
Code:
function show_fieldset(id) {
// if style.display is set to something other than block
if(document.getElementById(id).style.display != 'block') {
// set it to block
document.getElementById(id).style.display = 'block';
} else {
// otherwise, set it to none
document.getElementById(id).style.display = 'none';
}
}
in these i've applied the style"" attribute right on the element in the html because it was for showing / hiding a fieldset, so a class in the css file was no more effecient.
if you're going to use it on a lot of elements you'd use
document.getElementById(id).className and your class name instead of
document.getElementById(id).style.display.