Web Analytics Made Easy -
StatCounter changing a form value with javscript - CodingForum

Announcement

Collapse
No announcement yet.

changing a form value with javscript

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • changing a form value with javscript

    Hi all,

    i found this javascript that replace a form value with another

    <FORM name="myForm2">
    <INPUT type="text" name="myText2" value="value1" size="20">
    &nbsp;&nbsp;
    <INPUT type="button" name="change" value="Click to see new text!" onClick="document.myForm2.myText2.value='value2'">
    </FORM>
    how can i change it so it uses a text link to put the new value into the form field instead of a button?
    i tried a normal hyperlink but it didnt work

    any ideas?

    thanks
    -c0lin

  • #2
    Here's one way;
    <FORM name="myForm2">
    <INPUT type="text" name="myText2" value="value1" size="20">
    </FORM>
    <a href="#" onclick="javascript:document.myForm2.myText2.value='value2'">Change Value</a>


    .....Willy

    Comment


    • #3
      that works great thanks Willy

      Comment

      Working...
      X