View Full Version : Javascript site search

12-06-2004, 02:31 PM
Hi All,

Bit of a js novice here so forgive me if this is a bit long winded!

I have been asked by a client to provide an internal javascript site search facility to allow users to search for video clips contained in a folder on the server. This will have to work client side as the site will be distributed on CD_ROm as well as online.

Heres the scenario:

1. A user visits the search page and is offered six drop-down boxes containing pre-defined search 'keywords'

2. The user selects the relevant keywords (any brop-downs not selected default to an "all" value) and submits the form.

3. The js code searches a pre-defined selection of files/pages for the selected search criteria (1 from each of the 6 drop-downs) and displays the search results with hyperlinks.

I have found js searches that use a keyword entered into a text box but as yet not one that uses drop-down boxes.

Not a problem in PHP but in client side js...HELP!!!!!

Thanks in advace :-)

12-06-2004, 07:23 PM
where those scripts get the text value from the textbox--

var theVariable = document.FormName.ElementName.value

you need to use code that gets it from the select

Get the value: <option value="theValue">theText</option>

var sel1 = document.FormName.SelectName;
var theVariable = sel1.options[sel1.selectedIndex].value;


Get the text: <option value="theValue">theText</option>

var sel1 = document.FormName.SelectName;
var theVariable = sel1.options[sel1.selectedIndex].text;


12-08-2004, 10:37 AM
Thanks for your input Eric!

Is it possibly to assign a wildcard 'All' value to a variable?

Also anyone have any poiners on what I do with the variable values once I have them?

(I did warn you I was a novice..sorry :-) )