views:

51

answers:

3

Im designing my school's website and I kind of want to do like a "What are you looking for" page with only an input box where people can enter in phone or something and it would be completed with autosuggest (got that part ok). Then when the user clicked go, the button would take them to the page defined by the search so it would go directly to the phone numbers page and vice versa. What would you suggest to do that?

A: 

Probably the best way to do this is to write a function which is attached to the submit action of your form. Then, you can have that function examine the contents of the input box to decide which page should be open.

You open the page with the code:

window.location = "http://www.WhateverSiteYouWant.com";

However, rather than trying to guess what all a user might type, you might just consider using a dropdown navigation list. You can see an example of how to code one at http://www.thesitewizard.com/archive/navigation.shtml

Google can provide you with many more such examples.

Aaron
Thanks for the help!
Robbie
A: 

You could do it by setting the window.location.href to the URL want to redirect to. So in your button-click handler, you do:

window.location.href = "some_url";
krow
+1  A: 

For giving autosuggestion you can use Ajax concept.

rekha_sri