JavaScript - Dynamically Changing Links
HomeHTAJScriptJavaScriptPHP
Main Menu Home HTA JavaScript JScript PHP Examples Dynamically Creating Tables Dynamically Chaning Links Script Box Wormbites 2006 Includables ezCalendar getOrdinalFor(...) JXtension Other Libraries jQuery Prototype script.aculo.us

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!!!

Related Search Results

  1. JavaScript Box:
    A simple way to test out JavaScript. Test out your functions and objects. Do some advanced tests with JXtension.
  2. Wormbites 2008 (Desktop Version):
    The ultimate Snake game with multiple brain-teasing levels. You can also custom design you own levels.
  3. From JScript Arrays To VB Arrays:
    Learn how to convert from a JScript or JavaScript array to a VBArray.
  4. JavaScript Snippet - Get Current HTML Code:
    Learn how to access the HTML code that composes the page at this exact moment.
  5. Validation Using JavaScript:
    Learn how to do data validation with JavaScript.