Results 1 to 2 of 2

Thread: <select> drop down and window.location

  1. #1
    Join Date
    Jun 2008
    Posts
    121
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default <select> drop down and window.location

    hi all

    i have two dynamic drop downs of dealer id and category id which work properly with window.location

    Code:
    var dealerid;
    function getList(xyz)
    {
    window.location='manage_products.php?category_id=' + xyz;
    }
    function getProducts(dealer_id)
    {
    var catid=document.form1.category.value;
    window.location='manage_products.php?dealer_id=' + dealer_id + "&category_id="+catid ;
    }
    but now i want to add static drop down of sub category and make use of window.location which i m not able to do

    Code:
    <select name="sub_catg" onchange="getSb(this.value)"  id="sub_catg">
    <option>Select Sub Category</option>
    <option value="Batteries">Batteries</option>
    <option value="Leather & PU Cases">Leather &amp; PU Cases</option>
    <option value="Crystal & Rubber Coated Cases">Crystal &amp; Rubber Coated Cases</option>
    <option value="Car Mounts & USB Cradles">Car Mounts &amp; USB Cradles</option>
    <option value="AC Chargers & Car Chargers">AC Chargers &amp; Car Chargers</option>
    </select>
    This is function that is not working
    Code:
    <script language="javascript">
    var subid=document.form1.sub_catg.value;
    function getSb(subid)
    {
    window.location='manage_products.php?dealer_id=' + dealer_id + "&category_id="+catid + "&sub_catg=" + subid ;
    }
    </script>
    vineet

  2. #2
    Join Date
    Jul 2006
    Posts
    497
    Thanks
    8
    Thanked 70 Times in 70 Posts

    Default

    dealer_id and catid are undefined.... Look at what the second function you posted does to solve this and do it for both fields.
    -- Chris
    informal JavaScript student of Douglas Crockford
    I like wikis - a lot.

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
  •