Jump to content

Highlight a Link After It's Been Clicked?


Dan_Mason

Recommended Posts

Hello :)

 

I have used some Javascript to be able to switch between 3 generated graphs on a page. I wanted to do this so that the page didnt have to be refreshed every time a new graph was selected. All it is basically doing is switching between pictures, Here is a screenshot:

 

Switchgraphpics.jpg

 

All I really want to do is leave the last Hyperlink clicked highlighted, so that it is really obvious to the user which graph they are viewing!

 

Any help would be much appreciated! :D

Link to comment
https://forums.phpfreaks.com/topic/187383-highlight-a-link-after-its-been-clicked/
Share on other sites

You might run into some cross browser issues depending how you reference your html properties in javascript but that said the first thing I would think to do is use the OnClick function to call a function that applies highlighting to whatever html element was just clicked.  The trick is un-highlighting a value once another is clicked - one way to do this would be to remember which one was last clicked, and set it back to normal when the next is clicked, since you're dealing with only 3 values it would be simpler to just say that the items that don't get clicked, all get set back to normal, the one that did get clicked gets set to highlighted by your custom php function.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.