sendText Help

Discussion in 'JavaScript' started by jrp1, May 8, 2009.

  1. #1
    Im working on a script where, when you click an image, it automatically enters the text "FOO BAR" into a form field. How can I make it so just "FOO" is highlighted when this text is entered? Here's my current code:

    <div>
    <img src="/images/file.png" name="image" onClick="sendText(document.search.q, 'FOO BAR')">
    </div>
    Code (markup):

     
    jrp1, May 8, 2009 IP
  2. jrp1

    jrp1 Active Member

    Messages:
    93
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #2
    To elaborate, I need both words to be inserted into the form via Javascript, but only the word "FOO" to be highlighted.
     
    jrp1, May 8, 2009 IP
  3. hiteklife

    hiteklife Greenhorn

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #3
    Hey, I think I have what you're after. Try this:

    Does that help?
     
    hiteklife, May 10, 2009 IP