I have created a CSS solar system. Along the bottom is a list of planets. When you click on a planet name it goes to '#[planetname]speed' this is not set with JS. When you click on a planet's name I want a separate hyperlink (which would be 'info')to add an onClick attribute. If you click another planet's name the onClick attribute of the info link would change. Any help would be appreciated.
Are you trying to make a popup div with info in it or are you trying to make it go to a different page? There are a lot of different ways you can do this (assuming I'm thinking the same thing you are), however, it seems to me your trying to do it the hard way. Why not just make separate links for each individual planet instead of trying to make it dynamic. Sometimes static is the best way to go because it makes sure no mistakes will be made and it greatly simplifies things.
If this doesn't help you could you please post a link or an image as to what exactly your trying to do?
Here's some clarification: (N.B- When you click on a planet it is indicated and tracked, I haven't included this in my plan)
The deafult planet to track is earth:
When you click 'Info on Planet' it opens a modal window (I already have the modal script sorted. I've changed it to one where it gets launched by going to a # value. I now only need to change the href attribute not onClick):
But if I change the planet to track to Mars and click the link again:
It now displays info on mars. Each planet's modal is launched by going to #planetname.
To be honest I'm not 100% sure what your asking about but maybe I'm just overthinking it it.