Results 1 to 3 of 3

Thread: html form drop down issue

  1. #1
    Join Date
    Jan 2007
    Posts
    181
    Thanks
    5
    Thanked 3 Times in 3 Posts

    Default html form drop down issue

    How would u make a html drop down list link to a web site? i linked it up how i hought it would work.. but no luck..

    Code:
    <select name="Categories" id="Categories" style="width:220px"">
                                    <option value="http://www.google.com">testing</option>

    any ideas?

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    in what capacity do you need the website?
    ... do you want to go to said site?
    ...... navigate in current browser window? popup window? iframe?
    ...... navigate to site on selection or on a button click?
    ... do you want to store the site?
    ...... store in database?
    ...... store in variable?


    The method below I will show you how to navigate to the site by making a popup window when the option is selected.

    Code:
    __DOC_TYPE__
    <html>
    <head>
         <title>TITLE</title>
    
    <script type="text/javascript">
    
    function goTo(var url='')
    {
         if(isNull(url) || url == '') {alert("The URL is not valid, contact the system administrator");}
         else {
              window.open(url, 'popUpWin','menubar=1,toolbar=1,status=1,resizable=1,left=0,top=0').focus();
         }
    }
    </script>
    </head>
    <body>
    
    <form name="frm" action="void(0);">
    <label>
         Website:
         <select name="categories" onchange="goTo(this.value);return false">
              <option value="" selected="selected>&ndash; Select Website &ndash;</option>
              <option value="http://www.dynamicdrive.com">Dynamic Drive</option>
              <option value="http://www.google.com">Google</option>
              <option value="http://www.yahoo.com">Yahoo</option>
         </select>
    </label>
    </form>
    </body>
    </html>

  3. #3
    Join Date
    Jan 2007
    Posts
    181
    Thanks
    5
    Thanked 3 Times in 3 Posts

    Smile

    Thanks!
    Jon

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
  •