Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
134
rated 0 times [  135] [ 1]  / answers: 1 / hits: 58848  / 12 Years ago, thu, june 7, 2012, 12:00:00

I have this text box here...



<input name=search type=text maxlength=512 id=search class=searchField autocomplete=off title= />


and I also have this submit



<input type=submit name=btnSearch value=Search onclick=location.href='http://www.website.com/search/'; id=btnSearch class=buttonSearch />


what I am trying to do is add whatever is in the text box in my



onclick=location.href='http://www.website.com/search/';


so it would look like this..



onclick=location.href='http://www.website.com/search/what ever the user searches';


how would I go about doing this, I have been googling my little heart out.


More From » onclick

 Answers
30

This should work:



onclick=location.href='http://www.website.com/search/'+document.getElementById('search').value;


But I wouldn't ever write that in one of my project as writing script directly on tags is a bad practice.


[#85078] Wednesday, June 6, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
donaldcristianl

Total Points: 114
Total Questions: 95
Total Answers: 110

Location: Bonaire
Member since Sat, May 27, 2023
1 Year ago
;