It is a very bad idea to change site content using Javascript, because there are a lot of users with JS turned off or not even integrated, who would not be able to view your site properly. Also the function document.getElementById is not supported by all the old browsers, there are two alternatives:
document.all (old Microsoft Internet Explorers) and document.layers (old Netscape browsers). So do yourself a favor and don't rely on JS for such essential things as showing and hiding content.
If you do, then be sure to do it so, that the site is still viewable for those who don't have the JS support. In this case for example you could do it like this:
<div id="firstpage"><a name="first">...</a></div> <div id="secondpage"><a name="second">...</a></div> <div id="thirdpage"><a name="third">...</a></div>and then you can dynamically hide the layers onLoad (be sure to set it up so that you use the DOM-model, the IE-model and the Netscape-model (getElementById, all, layers) to provide maximum compatibility.
Btw. if you're worried that your index file might get to big, but you totally don't want to reload a page (which is stupid I think, but well.. there might be good reasons for this), you can make use of the AJAX-code (JS communicates with the server and gets the new content when it needs it. AJAX tends to get more widely supported, but it's still quite new!
Oh and if you, DigitalDingo, are still wondering what to put for item, the correct syntax would be to call the function change, the following way:current=document.getElementById("index"); function change( item ) { element=document.getElementById(item); current.style.display="none"; element.style.display="block"; current = element; }What should I put instead of “item”? Should I write “div” or something like that?
<a href="java script:change('the_id_of_the_element_you_want_to_show')">Show Second Page, hide old Page</a>Get it? Remember that's not so great code, if you really intend using something like this, post back and we can work something out.



