fffanatics 0 Report post Posted April 22, 2006 Hey everyone. I am currently trying to finish my navigation bar on the left side of my website and i am running in to some trouble with the css. I know how to change the items class when a user clicks it using onClick = "this.class = newClass"; but i need to know have to change a different class when a user clicks that link. AKA, how do i get the this part of a class that isnt that current one. For instance if i have a class called subMenu and i want to change it to showSubMenu when a user clicks a link that is of class menu how would i do this not using javascript but just pure css? Thanks for your help because i just cant really find anything good on google for this and it would be awesome to implent this feature on my navigation bar. Thanks again. Share this post Link to post Share on other sites
rldowling03 0 Report post Posted April 22, 2006 i'm confused. What are you trying to do Share this post Link to post Share on other sites
Tyssen 0 Report post Posted April 22, 2006 i'm confused. What are you trying to doSame here. Got no idea what you want. Share this post Link to post Share on other sites
fffanatics 0 Report post Posted April 23, 2006 Ok first of all i screwed up the title. It should be CSS and not PHP. But this is what i want to do without javascript. I want to use the onClick function of the a tag to change the property of a css tag that is not the current links class. Here is an example but it doesnt work:Styles: .menu { text-decoration : underline; }.subMenu { display : none; } <div class="menu" onClick="subMenu.display = block;">Menu</div><div class="subMenu">Submenu</div> Thus, i need the onClick of menu to change the property of the subMenu css class. Anyone know how to do this? Sorry about the bad explaination on the previous post but it was late and i was frustrated with it and was looking for some help. Ill be sure to try to make my questions clearer from now on. Thanks again. Share this post Link to post Share on other sites
Tyssen 0 Report post Posted April 23, 2006 You mean like on this site: http://www.nwfs.com.au/ Share this post Link to post Share on other sites
fffanatics 0 Report post Posted April 24, 2006 Pretty much except i was hoping to do it without and javascript involved so that it would be compatible with non-javascript enabled browsers. I tried that with javascript disabled and it just went to a different page and that would not work for me since i use includes and you just wont ever get the submenu. I will try to maybe fool with it and see if i can get it to work using part of their style. Share this post Link to post Share on other sites
Tyssen 0 Report post Posted April 24, 2006 Onclick is a javascript function, not PHP. You can't use PHP to do anything that isn't submitted to the server first. Share this post Link to post Share on other sites
fffanatics 0 Report post Posted April 24, 2006 Like i said i mistitled this topic. However, i would like to thank tyssen for the website link. After messing with their code for like 10 minutes and disabling javascript in my browser, i still was able to get the code to work the way i wanted it to. I realized that if i put it in a link and not just the surrounding div, that if javascript was disabled, it would change the page to the href thus allowing me to use the post a variable to say show this class. Thanks a ton cuase with out that site i probably would have gone crazy trying to figure this out. Thanks again Share this post Link to post Share on other sites