title: How do I pass the link anchor text
body: <p>I'm new to Javascript and I've asked several of my Javascript friends and they don't seem to have an answer. I've been developing a simple search query in PHP and it outputs several results for example:</p>
  
  <pre><code>&lt;a href="#" onclick="injectForm(this);"&gt;Result Text Here&lt;/a&gt;
  &lt;a href="#" onclick="injectForm(this);"&gt;Result Text 2 Here&lt;/a&gt;
  &lt;a href="#" onclick="injectForm(this);"&gt;Result Text 3 Here&lt;/a&gt;
  
  
  &lt;form id="form1" name="form1" method="post" action=""&gt;
  &lt;label for="textfield"&gt;&lt;/label&gt;
  &lt;input type="text" name="textfield" id="textfield" /&gt;Search
  &lt;/form&gt;
  </code></pre>
  
  <p>pseudocode for injectForm();</p>
  
  <ul>
  <li>grab the .value of the link that was just clicked</li>
  <li>pass that into variable  i.e.  result = (something something).value</li>
  <li>set form1.textfield.value = result</li>
  </ul>
  
  <p>What I'd like to do is have a simple injectForm() function that reads the value of the result "Anchor Text Here" so when someone clicks on it - it drops the value "Result Text Here" it into the "textfield" in the form.  I believe you can do this with DOM - I do NOT want to use any JS libraries such as Jquery.</p>
  
  <p>Anyone have ideas?  If I used a different DIV or SPAN tag for each href you could use DOM - i'd like to not have to number each result with a different div or class if possible - just reading the relative this(); kind of thingy.</p>