Results 1 to 5 of 5

Thread: a search box with drop down options

  1. #1
    Join Date
    May 2006
    Posts
    98
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default a search box with drop down options

    Hi, I have different content on different pages.
    I have search boxes which search each content and the results as they are different get directed to different pages.
    Is there a script on dynamic drive that has a dropdown options combined with the search box so you could select what area you wish to search. I cannot find one but have seen one on a delicious http://delicious.com/popular/linux
    Thanks
    Richard

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    You mean like something that happens when you type in a users name in the "User Name:" input on this page:
    http://www.dynamicdrive.com/forums/search.php
    Or something more like:
    http://www.dynamicdrive.com/dynamici...lapcontent.htm
    Jeremy | jfein.net

  3. The Following User Says Thank You to Nile For This Useful Post:

    rich1234 (08-13-2008)

  4. #3
    Join Date
    May 2006
    Posts
    98
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default

    Dear Nile, Not exactly, really like this
    http://www.javascriptkit.com/script/cut130.shtml

    but where the form action is changed dependant on selection.
    Thanks
    Richard

  5. #4
    Join Date
    May 2006
    Posts
    98
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default partial answer

    Hi actually I found this and got it working but need a drop down in place of the radio buttons. Any ideas about altering the javascript?

    Code:
    <html>
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Name</title><script src="/js/validatesearch.js" type="text/javascript"></script>
    </head>
    
    <body>
    <script type="text/javascript" language="JavaScript">
    <!-- Copyright 2003 Bontrager Connection, LLC
    // See article "Changing Form Action URLs On-The-Fly" linked 
    // from URL /library/archives 
    // for more information about how to use this code.
    function ActionDeterminator()
    {
    if(document.myform.reason[0].checked == true) {
    document.myform.action = '/search.asp';
    }
    if(document.myform.reason[1].checked == true) {
    document.myform.action = '/businesssearch.asp';
    }
    if(document.myform.reason[2].checked == true) {
    document.myform.action = 'artschoolsearch.asp';
    }
    return true;
    }
    // -->
    </script>
    
    <form name="myform" method="post" action="search.asp" onsubmit="return validate_form(this)">
    
    <input type="text" size="12" name="SearchWord" style="border: 0px solid #000; padding: 0pt; background-color: #c0c0c0; margin-left: 0px; margin-right: 0px; vertical-align: middle;">
    
    
    <input type="radio" checked name="reason">art
    <input type="radio" name="reason">business
    <input type="radio" name="reason">tips
    
    <input onClick="return ActionDeterminator();" value="search" type="submit" style="border: 0px solid #000; padding: 1px 2px; background-color: #808080;margin-left: 1px;  vertical-align: middle; font-size: 10px; font-family: Verdana;" >
    
    </form>
    </body>
    
    </html>
    Thanks
    Richard

  6. #5
    Join Date
    Jan 2006
    Location
    Ft. Smith, AR
    Posts
    795
    Thanks
    57
    Thanked 129 Times in 116 Posts

    Default

    I'm no javascript guru, but you might give this a shot...


    Code:
    <html>
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Name</title><script src="/js/validatesearch.js" type="text/javascript"></script>
    </head>
    
    <body>
    <script type="text/javascript" language="JavaScript">
    <!-- Copyright 2003 Bontrager Connection, LLC
    // See article "Changing Form Action URLs On-The-Fly" linked 
    // from URL /library/archives 
    // for more information about how to use this code.
    function ActionDeterminator()
    {
    if(document.myform.reason[0].selected == true) {
    document.myform.action = '/search.asp';
    }
    if(document.myform.reason[1].selected == true) {
    document.myform.action = '/businesssearch.asp';
    }
    if(document.myform.reason[2].selected == true) {
    document.myform.action = 'artschoolsearch.asp';
    }
    return true;
    }
    // -->
    </script>
    
    <form name="myform" method="post" action="search.asp" onsubmit="return validate_form(this)">
    
    <input type="text" size="12" name="SearchWord" style="border: 0px solid #000; padding: 0pt; background-color: #c0c0c0; margin-left: 0px; margin-right: 0px; vertical-align: middle;">
    
    <select> 
    <option selected name="reason">art</option>
    <option name="reason">business</option>
    <option name="reason">tips</option>
    </select>
    
    <input onClick="return ActionDeterminator();" value="search" type="submit" style="border: 0px solid #000; padding: 1px 2px; background-color: #808080;margin-left: 1px;  vertical-align: middle; font-size: 10px; font-family: Verdana;" >
    
    </form>
    </body>
    
    </html>
    --------------------------------------------------
    Reviews, Interviews, Tutorials, and STUFF
    --------------------------------------------------
    Home of the SexyBookmarks WordPress plugin

  7. The Following User Says Thank You to TheJoshMan For This Useful Post:

    rich1234 (08-13-2008)

Bookmarks

Posting Permissions

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