Dynamically update variables in a link

Out of context: Reply #13

  • Started
  • Last post
  • 15 Responses
  • welded0

    The onclick need not be on an anchor necessarily, but if that works for you then go for it. Also, you don't put 'javascript:' in the onclick attribute because those (onmouseover, et al) are only for javascripts anyway so no need to declare it. Anyway, you're pretty close:
    <a href="#" onclick="document.getElementById('your_hidden_field').value = 'brown'; return false;">BROWN</a>
    <input id="your_hidden_field" name="f_color" value="" />

    Something along those lines will work.

View thread