Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript site search

    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 :-)

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    where those scripts get the text value from the textbox--

    Code:
    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>
    Code:
    var sel1 = document.FormName.SelectName;
    var theVariable = sel1.options[sel1.selectedIndex].value;
    or

    Get the text: <option value="theValue">theText</option>
    Code:
    var sel1 = document.FormName.SelectName;
    var theVariable = sel1.options[sel1.selectedIndex].text;
    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    New to the CF scene
    Join Date
    Dec 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 :-) )


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •