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
2010-03-04 22:42:41
Thanks for the help!
Robbie
2010-03-08 03:00:00
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
2010-03-04 22:45:10