I have currently the following code:
<li><a href="index.php" id="1" onclick="document.getElementById('1').style.background = '#8B4513';">Weblog</a></li>
This changes the color, but because it opens index.php the color won’t stay at the same color. It returns to the original color.
How can i keep it the same color, in a different page?
Thanks
To start, an ID can not start with a number.
You have to catch the selected page on the server side and give it a class like selected and use CSS to do something like:
If you have no clue how to set a selected page with PHP, read this article: http://darkstar-media.blogspot.com/2009/04/css-page-selected-with-php.html