SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru GamerZ's Avatar
    Join Date
    Nov 2001
    Location
    Singapore
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Without The Need Of Submit Button

    Can i know how to create a drop down menu without the need of a submit button? Once user Choose his stuffs, it will auto submit the results without clicking submit?

    Thanks

  2. #2
    SitePoint Addict w3exit's Avatar
    Join Date
    Jun 2002
    Posts
    331
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe its done using the onclick function in Javascript ... check it out at javascriptkit.com

  3. #3
    SitePoint Guru GamerZ's Avatar
    Join Date
    Nov 2001
    Location
    Singapore
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm i can do it but there is some problem with php, thanks.

  4. #4
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    there shouldn't be any problem, make sure your escaping quotes etc.

    Anyway heres an example

    PHP Code:

    <script type="text/javascript">
      var 
    i=0;
      var 
    url = new Array();
      
    url[i++] = 'http://www.google.com';
      
    url[i++] = 'http://www.sitepoint.com';
      
    url[i++] = 'http://www.msn.com';

      var 
    x='<select onchange="document.location.href=this.options[this.selectedIndex].value;"><option value="">--Select option--</option>';

      for (
    i=0;i<url.length;i++)
      {
        
    x+='<option value="' +  url[i]  + '">' url[i] + '</option>';
      }
      
    x+='</select>';
      
    document.write(x);
    </script>

    or

      <select onchange="document.location.href=this.options[this.selectedIndex].value;">
        <option value="">--Select option--</option>
        <option value="http://www.google.com">google.com</option>
        <option value="http://www.sitepoint.com">sitepoint.com</option>
        <option value="http://www.msn.com">msn.com</option>
      </select> 

  5. #5
    SitePoint Guru GamerZ's Avatar
    Join Date
    Nov 2001
    Location
    Singapore
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Alot =)


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
  •