If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Javascript Display/hide

Hello, i have almost no experience with Javascript but i had a problem which required me to use it.
the problem is a user should be able to hide/display a certain div which is located on the index and viewable from the entire site.

I found a very helpful code online but it still has one problem, as soon as a internal link or button is clicked it resets the hidden div to it's default status (for example, a user hides the div, then clicks a other button and then the div just reapers because display is it's current default status).

When a user clicks on a link or a button, a "new" page is loaded in the browser (even if its the same URL), and the state of the current page is lost unless you take steps to preserve the necessary information. In this case, you'd need to save the value of the 'display' property of the 'divname' <div>, then pass that information to all subsequent pages so they can render "new" pages using that information. This is often done by passing the information in a query string attached to the URL of the new pages (ie. 'http://www.example.com/somepage.html?divname=block'). The new pages retreive that information using JavaScript to check 'location.search' for the presence of a query string, decoding it, and taking whatever steps are required.

It's simple enough, but may be beyond your current experience if all you do is copy and paste code and its impossible to provide a solution here without seeing all of your code. You might take this as an opportunity to actually learn how to program in JavaScript. There are lots of online tutorials and it doesn't take that long to learn the basics. Good luck!