Replace dashes with other text

Discussion in 'JavaScript' started by emike, Mar 31, 2008.

  1. #1
    I’m trying to replace a dashed line with an answer after a “click here” prompt. Here’s an example:

    1) Find the principal parts of the verb “drive” by filling in the blanks below. Click here to check your answer.

    I _____ now. (Present tense)
    I _____ in the past ( past tense)
    I have ______ every day. (Past participle)

    After “Click here” is clicked, the above will be changed to:

    I drive now. (Present tense)
    I drove in the past ( past tense)
    I have driven every day. (Past participle)

    Is there a way to do this with javascript/scriptaculous? I’m building an instuctional site on English grammar. I’d appreciate some help.

    Thanks,
    Mike
     
    emike, Mar 31, 2008 IP
  2. budster

    budster Peon

    Messages:
    18
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hi,
    If you give your input elements id values, you can then use document.getElementById('idvalue').value = 'newvalue'; from an onClick function attached to your button.
    Hope this helps
     
    budster, Mar 31, 2008 IP