Website development: creating a search box

westy159

In Runtime
Messages
182
Location
United Kingdom
Hi,

What I want on my website is a field for a user to input text (e.g. communication) and a list of related pages on the website to come up (e.g video conferencing etc).

What language would i need to do this in? And what other things will be necessary? I have decent HTML and CSS knowledge, if this sort of function would require something like javascript I dont think it will be too hard for me to pick up. If someone can point me towards a tutorial for doing this that'd be great.

Thanks in advance.
 
The actual search box would just be html, an example being:

<form>
Search site: <input type="text" name="searchbox">
</form>

For the actual job of searching the site, it would probably need to be done in any kind of scripting language. I know... Well, very little about the actual scripting/programming in website design, but I would assume PHP is a better way of doing it - however it can be done by scripting, specifically in Javascript.

There are some examples of it narrowing Google searches to just that website, and your search term. Can't see why it couldn't be used.

If you haven't done any Javascript before, I would personally suggest you find the code online, and edit it for your use. Would take way too long learning how to use it, if it was just to do that one thing.
 
Yeah, this is ajax.
So on the server you write a script in whatever server side language you are using that takes a term as a parameter and returns XML or JSON with a list of related terms. On the client side, you write some javascript that is invoked on every key press inside the field and if the previous query was more than 2 seconds ago, query your server script and update the dropdown.
 
Back
Top Bottom