View Single Post
-Job-
-Job- is offline
#6
May11-07, 08:54 PM
Sci Advisor
-Job-'s Avatar
P: 1,132
Since your input object only has a name property (and no ID)
<INPUT name=keywords>
You can use the following to get its value:
document.getElementsByName('keywords')[0].value
So in your code you'd have:
<SCRIPT type=text/javascript>
      $(document).ready(
        function(){
          $("//p#b1/a").click(
            function(){
              $("//div#content").empty();
              $("//div#content").load("hello.php?hello=" + document.getElementsByName('keywords')[0].value);

            }
          )
        }
      )
    </SCRIPT>
If you give your input control an ID:
<INPUT name=keywords id=keywords>
You can use the following to get its value:
document.getElementById('keywords').value;
Or you can use jquery:
$("input#keywords").val()
And you'd have, after giving your control an ID:
<SCRIPT type=text/javascript>
      $(document).ready(
        function(){
          $("//p#b1/a").click(
            function(){
              $("//div#content").empty();
              $("//div#content").load("hello.php?hello=" + $("input#keywords").val());

            }
          )
        }
      )
    </SCRIPT>