Here's a function I use that performs a very similar task. I'll use the PHP tags here for the comment coloring, but the code is regular JS
PHP Code:
function toggleDisp(node) {
if (is_ie4up) // Sniffer variable
node.style.display = (node.currentStyle.display == 'none') ? 'block' : 'none';
else if (is_gecko) { // Sniffer variable
node.style.display = (node.style.display == 'none' || node.style.display == '') ? 'block' : 'none';
}
else
alert('Your browser does not have the javascript support for these menu featuers.\nPlease upgrade to the most recent version of Internet Explorer, Netscape, or Mozilla.');
}
Bookmarks