All4172 Posted March 13, 2006 Share Posted March 13, 2006 I have a menu when a user clicks on a Link, its opens up data below. I do this by using the following code:<id=navlist><a href=# onclick="show('screen_shots');return false;">. My question is, how can I modify this so where it not only does what it currently does, but also when a user clicks on the link above, it'll change the CSS ID from navlist to current. Then when a user clicks on another link, it'll go back from current to navlist. Any ideas would be greatly appreciated as my knowledge of JS is very limited. Quote Link to comment https://forums.phpfreaks.com/topic/4854-changing-id-tags-via-js/ Share on other sites More sharing options...
hitman6003 Posted March 15, 2006 Share Posted March 15, 2006 [code]<script type="text/javascript"> var c = ''; function changeme(w, e) { c.className = "navlist"; e.className = "current"; c = e; //show(w); }</script><style>.navlist { background-color: #0099CC;}.current { background-color: #999933;}</style><div class="navlist"><a href="#" onclick="javascript: changeme('screen_shots', this);">Menu Item 1</a></div><div class="navlist"><a href="#" onclick="javascript: changeme('screen_shots', this);">Menu Item 2</a></div><div class="navlist"><a href="#" onclick="javascript: changeme('screen_shots', this);">Menu Item 3</a></div><div class="navlist"><a href="#" onclick="javascript: changeme('screen_shots', this);">Menu Item 4</a></div><div class="navlist"><a href="#" onclick="javascript: changeme('screen_shots', this);">Menu Item 5</a></div><div class="navlist"><a href="#" onclick="javascript: changeme('screen_shots', this);">Menu Item 6</a></div>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/4854-changing-id-tags-via-js/#findComment-17669 Share on other sites More sharing options...
All4172 Posted March 16, 2006 Author Share Posted March 16, 2006 Thanks for the help, I really do appreciate it. :)I'll try it out now. Quote Link to comment https://forums.phpfreaks.com/topic/4854-changing-id-tags-via-js/#findComment-18053 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.