@David_HarrisonSep 23.2005 — #Well you could apply a class to them all and then just say:.nav{ display:none; }However I'd take a guess that you want to use JavaScript to show them all at the appropriate time, if that is the case then it would be better to use JavaScript to hide them all in the first place so that users who do not have JavaScript will still be able to see all of the content.
@KravvitzSep 23.2005 — #There is no display:show. You're confusing display with the visibility property for which Netscape 4.x uses a proprietary value of "show" instead "visible".
You mean display:block. Don't forget that many elements are not display:block by default.
@David_HarrisonSep 24.2005 — #Here is what I recommend, put all of your #nav's into a container element and give that container element an ID, for example, id="navContainer". Then put the following CSS into a separate file all on it's lonesome:#navContainer div{ display:none; }
#navContainer #nav1{ display:block; }I am assuming that all of your #nav's are <div> tags and that each #nav does not contain any other <div> tags, (if that is not the case then you would have to show me your markup so that I can come up with a different solution).
Then put this JavaScript in a separate .js file:var head = document.getElementsByTagName("head")[0];
var newStyles = document.createElement("link"); newStyles.type = "text/css"; newStyles.rel = "stylesheet"; newStyles.href = "whatever.css"; /* Whatever you called the style-sheet up there ^ */
window.onload = function(){ loaded = true; }Then add this line of code immediately after the opening <body> tag:<script type="text/javascript" src="whatever.js"></script>What happens is as follows, the script runs and appends the stylesheet to the head section of the page, the styles are loaded and all but the first #nav are hidden, then the rest of the page goes onto load as normal.
You can call the function showN to show one layer and hide all others, however I have thrown in some code to make sure that the function will only run after the page has finished loading, to prevent there from being any errors in trying to show layers that don't exist yet.
In the case that the user doesn't have JavaScript enabled, all layers will be displayed, therefore although it doesn't keep to the originally intended design, at least the users can still see all of the content.
@David_HarrisonSep 24.2005 — #Let them show errors, it's not worth the extra code considering [url=http://www.thecounter.com/stats/2005/September/browser.php]their usage[/url]. It won't make the code any more or less accessible, the JavaScript will simply fail to run and those browsers will fall back on the no-JavaScript accessibility.