| JavaScript - Dynamically Changing Links |
The links below this paragraph illustrate one way to dynamically change a link's text and address to which it points. First, the getElementById method is used to get a reference to the link that was clicked on. Next, it is determined how to act based on values kept either in the text or in the link (href property) itself. Then the href may be changed to the appropriate value and the innerHTML property is modified to change the link's text. Please feel free to check out the source code to see what is going on under the hood.
Click me, but be warned that I have a click limit of 3 times.
Click me, but be warned that I have a click limit of 5 times.
Click me, but be warned that I have a click limit of 10 times.
Click me to turn me on!!!
Powered by JXtension.